OpenmaizeJWT v0.10.1 OpenmaizeJWT.Create

Module to create JSON Web Tokens.

JSON Web Token structure

The header contains values for typ, which is “JWT”, alg, which can be “HS256” or “HS512” (the default), and kid, which is used to identify which key was used in the signature.

The main body of the token has user information and values for nbf, which is the time before which the token cannot be used, and exp, which is the time when the token expires.

Summary

Functions

Generate a JSON Web Token

Functions

generate_token(user, arg)

Generate a JSON Web Token.

This function is usually called by the add_token function in the OpenmaizeJWT.Plug module, but it can also be called directly.

user is a map containing the user information, which needs to contain values for id, a unique identifier, which is username by default, role, nbf_delay, which is the number of minutes in the future after which the token can be used, and token_validity, which is the number of minutes that the token will be valid for.