elixir-mint / mint

Functional HTTP client for Elixir with support for HTTP/1 and HTTP/2 🌱
Apache License 2.0
1.37k stars 112 forks source link

Basic authorization a la Curl #385

Closed ndrean closed 1 year ago

ndrean commented 1 year ago

I don't see how you set curl -u user:pwd with Mint in the docs. Using header. =[Authorization: Bearer #{Base.encode64("user:pass")} ] does not work

whatyouhide commented 1 year ago

Hey @ndrean, -u in curl is a convenience over headers as you said. As per Wikipedia, for example, you need to use the Authorization but use Basic generally rather than Bearer:

{"authorization", "Basic #{Base.encode64("<username>:<password>")}"}

We don't plan to support conveniences over authentication methods such as this one in Mint, since the client is intended to be low level.

Thanks!