Today I Learned

hashrocket A Hashrocket project

Authenticate Req Requests with Basic Auth

Req has a built-in for handling some auth mechanisms, such as Basic Auth, Bearer, and netrc.

You can send the auth as a tuple, where the first element is the type and the second is the credential -

Req.post("https://example.com", json %{foo: "bar"}, auth: {:basic, "user:password"})

https://hexdocs.pm/req/Req.Steps.html#auth/1

See More #elixir TILs
Looking for help? At Hashrocket, we 💜 Elixir! From our many Elixir client projects, to sponsoring the Chicago Elixir Meetup, to the source code for this application, we are invested in this community. Contact us today to talk about your Elixir project.