# `Backplane.Oauth.BasicAuth`
[🔗](https://github.com/gsmlg-opt/backplane/blob/v1.10.77/apps/backplane_oauth/lib/backplane/oauth/utils/basic_auth.ex#L1)

HTTP BasicAuth utilities

Provide utilities to decode Basic authorization header as stated in [RFC 7617 - The 'Basic' HTTP Authentication Scheme](https://tools.ietf.org/html/rfc7617)

# `decode`

```elixir
@spec decode(authorization_header :: String.t()) ::
  {:ok, [String.t()]} | {:error, String.t()}
```

Decode given authorization header and returns an array containing username and password.

## Examples
    iex> Backplane.Oauth.BasicAuth.decode("Basic dXNlcm5hbWU6cGFzc3dvcmQ=")
    {:ok, ["username", "password"]}

    iex> Backplane.Oauth.BasicAuth.decode("bad_authorization_header")
    {:error, "`bad_authorization_header` is not a valid Basic authorization header."}

---

*Consult [api-reference.md](api-reference.md) for complete listing*
