BtrzAuth v1.2.0 BtrzAuth View Source

BtrzAuth is the authentication api for the Betterez Elixir APIs.

Link to this section Summary

Functions

Generates an internal token using the configuration main or secondary secret keys.

Generates an user token using the configuration secret keys.

Link to this section Functions

Link to this function

internal_auth_token(opts)

View Source
internal_auth_token(Keyword.t()) ::
  {:ok, Guardian.Token.token(), Guardian.Token.claims()} | {:error, any()}

Generates an internal token using the configuration main or secondary secret keys.

It will return a token using the issuer passed by configuration and %{} claims.

Options:

  • issuer - the issuer of the token
  • main_secret - main secret key
  • secondary_secret - secondary secret key
Link to this function

user_auth_token(user, opts)

View Source
user_auth_token(Map.t(), Keyword.t()) ::
  {:ok, Guardian.Token.token(), Guardian.Token.claims()} | {:error, any()}

Generates an user token using the configuration secret keys.

Options:

  • issuer - the issuer of the token
  • secret - secret key
  • claims - custom claims for your token. Default %{}.