View Source PrimaAuth0Ex.LocalToken (prima_auth0_ex v0.9.1)

Utilities to help working with prima_auth0_ex on a local environment, without the need to integrate with Auth0.

Summary

Functions

Forge a token with the desired payload. Custom claims can be passed as keyword options.

Generate a UNIX timestamp shifted by the given time. Can be used to quickly generate timestamps for iat and exp claims.

Functions

forge(audience, extra_claims \\ [])

@spec forge(String.t(), Keyword.t()) :: String.t()

Forge a token with the desired payload. Custom claims can be passed as keyword options.

The signature will be generated locally, hence it will not be valid. For this reason, this function should be used for local development only.

time_from_now(options)

@spec time_from_now(Timex.shift_options()) :: non_neg_integer()

Generate a UNIX timestamp shifted by the given time. Can be used to quickly generate timestamps for iat and exp claims.

options must be compliant to Timex.shift_options(). E.g. PrimaAuth0Ex.LocalToken.time_from_now(hours: -1) will return the UNIX timestamp for one hour ago.