authex v0.1.1 Authex.Token View Source

Link to this section Summary

Functions

Creates a new Authex.Token struct from the given claims and options

Link to this section Types

Link to this type t() View Source
t() :: %Authex.Token{aud: binary(), exp: integer(), iat: integer(), iss: binary(), jti: binary(), nbf: integer(), scopes: list(), sub: binary() | integer()}

Link to this section Functions

Link to this function new(claims \\ [], options \\ []) View Source
new(list(), list()) :: t()

Creates a new Authex.Token struct from the given claims and options

Parameters

  • claims: A keyword list of JWT claims.
  • options: A keyword list of options.

Options

  • :time - the base time (timestamp format) in which to use.
  • :ttl - the TTL for the token.

Examples

iex> token = Authex.Token.new([sub: 1], [ttl: 60])
iex> with %Authex.Token{sub: sub} <- token, do: sub
1