View Source BtrzAuth (BtrzAuth v1.3.0)

BtrzAuth is the authentication api for the Betterez Elixir APIs.

Summary

Functions

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

Generates an user token using the configuration secret keys.

Functions

Link to this function

internal_auth_token(opts)

View Source
@spec 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
@spec 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 %{}.