[erlang-questions] HTTP client for OAuth

Unix One unix1@REDACTED
Thu Feb 25 04:49:23 CET 2016


On 02/24/2016 07:49 AM, Garrett Smith wrote:
> I'm interfacing with various OAuth providers within an Erlang
> application and I need a simple HTTP client. I've poked around the
> ecosystem and have learned that HTTP clients are the new MySQL clients
> in terms of which-one-to-freakin-use.

When I was writing a client for a proprietary backend that used HTTP and 
required its own authentication, I decided to split things up a bit: I 
created an HTTP client wrapper[1] that accomplished 3 things:

- acted as a wrapper over a number of actual HTTP clients via a behavior 
(initially supporting gun and httpc, was planning to add hackney later)
- exposed a behavior for authentication[2]
- exposed a behavior for application specific functionality/requests[3]

You can see the sample implementation[4].

My intent was to create an HTTP client application where you would only 
need to plug in your custom application functions and authentication. I 
haven't updated it in a while, so I wouldn't be surprised if it's broken 
against current gun.

[1] https://github.com/unix1/httpclient (I know, very poorly named)
[2] https://github.com/unix1/httpclient/blob/master/guide/Login_Handler.md
[3] https://github.com/unix1/httpclient/blob/master/guide/Service_Handler.md
[4] https://github.com/unix1/splunkclient



More information about the erlang-questions mailing list