oauth2 icon indicating copy to clipboard operation
oauth2 copied to clipboard

Allow configurable HTTP Client library

Open alexgleason opened this issue 4 years ago • 2 comments

Users can supply their own HTTP Client module to be used by OAuth2.Request:

config :oauth2, http_client: MyCustomClient

The default is OAuth2.HTTPClient.Hackney which conforms to the OAuth2.HTTPClient behaviour.

I am writing a Ueberauth strategy using this library, and I want to be able to mock the HTTP client for automated tests. Making it configurable allows that to be possible. There are other legitimate reasons someone might want to provide their own module.

alexgleason avatar Nov 11 '21 21:11 alexgleason

Would be prudent to leverage https://github.com/teamon/tesla?

yordis avatar Jan 04 '22 07:01 yordis

Would be prudent to leverage https://github.com/teamon/tesla?

I'm +1 for this, this abstracts away different http client internals so there's no need to create multiple adapters.

escobera avatar Apr 26 '22 19:04 escobera

This is possible in the latest version using Tesla.

@alexgleason thank you so much for the work regardless.

yordis avatar Jan 29 '23 22:01 yordis

Cool!

alexgleason avatar Jan 29 '23 22:01 alexgleason