lostisland / faraday

Simple, but flexible HTTP client library, with support for multiple backends.
https://lostisland.github.io/faraday
MIT License
5.7k stars 971 forks source link

Make Authentication middleware transition easier #1405

Open iMacTia opened 2 years ago

iMacTia commented 2 years ago

Issue description

As discussed in https://github.com/lostisland/faraday/discussions/1358#discussioncomment-2245690, it is currently not a straightforward process to support both Faraday v1 and v2 ways of adding authentication to a request.

CHECKLIST (delete before creating the issue)

ariana-paris commented 2 years ago

While the documentation is being updated, can I put in a vote for an example of token authorization?

I understood the bit about changing my conn.authorization to conn.request :authorization, but then is it 'Token'? Is it :token? Do I still need the token: XYZ I have in my v1 code or is it just 'XYZ'? Is there a way to link to a complete list of the options rather than guessing based on the HTTP spec? I'd normally experiment but I'm still on v1.x so nothing works anyway, so just thought that would preempt the same questions when my future self has to use 2.x... Thanks! 😀

iMacTia commented 2 years ago

That's a fair point @ariana-paris, the documentation currently assumes a certain level of understanding of the code internals in order to achieve the desired result. This should also be addressed in scope of this ticket 👍. A few examples covering the most common HTTP Authentication mechanisms would be extremely useful. Thanks for raising this!