Phauxth v2.0.0-beta.1 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.
You must define a create_session function in the user_context
module if you are using this Plug. The create_session function
should return {:ok, session} or {:error, message}.
This module also contains functions to add / delete the remember_me
cookie.
Options
There is one option:
:log_meta- additional custom metadata for Phauxth.Log- this should be a keyword list
There are also options for signing / verifying the token. See the documentation for the Phauxth.Token module for details.
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
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.