Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

Authenticated HTTP requests

authenticated-http-requests.livemd

Authenticated HTTP requests

Mix.install([
  {:req, "~> 0.4.0"}
])

Making GET request with the req library

req =
  Req.new(
    base_url: "https://api.github.com/users/1-bit-wonder",
    headers: %{
      authorization: "bearer " <> System.fetch_env!("LB_GITHUB_TOKEN"),
      accept: "application/vnd.github+json"
    }
  )

{:ok, res} = Req.get(req)

Section