# `AuthPlug.Helpers`

Helper functions for apps using auth_plug.

# `check_environment_vars`

`check_environment_vars/0` displays a friendly error message
if the AUTH_API_KEY environment variable is not defined.

# `get_baseurl_from_auth_api_key`

`get_baseurl_from_auth_api_key/0` returns the base url from
the AUTH_API_KEY environment variable.

## Examples

  iex> AuthPlug.Helpers.get_baseurl_from_auth_api_key()
  "authdemo.fly.dev"

# `get_baseurl_from_conn`

```elixir
@spec get_baseurl_from_conn(Map) :: String.t()
```

`get_baseurl_from_conn/1` derives the base URL from the conn struct.

## Examples

iex> AuthPlug.Helpers.get_baseurl_from_conn(conn)
"https://app.dwyl.com"

# `strip_struct_metadata`

`strip_struct_metadata/1` removes the Ecto Struct metadata from a struct.
This is essential before attempting to create a JWT as `Jason.encode/2`
chokes on any invalid data. See: github.com/dwyl/auth_plug/issues/16

---

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