Phauxth v2.0.0-alpha.0 Phauxth.Remember View Source
Remember me module.
Checks for a remember_me
cookie, which contains a token. The token is
then checked, and if it is valid, the user is added to the session.
This module also contains functions to add / delete the remember_me
cookie.
Options
There are three options:
:session_module
- the sessions module to be used- the default is Phauxth.Config.session_module()
:max_age
- the length of the validity of the cookie / token- the default is one week
:log_meta
- additional custom metadata for Phauxth.Log- this should be a keyword list
In addition, there are also options for generating the token.
Examples
Add the following line to the pipeline you want to authenticate in
the web/router.ex
file:
plug Phauxth.Authenticate
plug Phauxth.Remember
Make sure you add the Phauxth.Remember Plug after Phauxth.Authenticate.
Link to this section Summary
Functions
Adds a remember me cookie to the conn
Deletes the remember_me cookie from the conn
Gets the user data from the token
Link to this section Functions
add_rem_cookie(Plug.Conn.t(), integer(), integer()) :: Plug.Conn.t()
Adds a remember me cookie to the conn.
delete_rem_cookie(Plug.Conn.t()) :: Plug.Conn.t()
Deletes the remember_me cookie from the conn.
get_user_data(Plug.Conn.t(), String.t(), tuple()) :: map() | nil
Gets the user data from the token.