Phauxth v0.11.0 Phauxth.Remember

Remember me Plug using Phoenix Token.

Options

There are four options:

  • context - the context to use when using Phoenix token

    • in most cases, this will be the name of the endpoint you are using
    • see the documentation for Phoenix.Token for more information
  • max_age - the length of the validity of the token

    • the default is four weeks
  • repo - the repo to be used

    • the default is MyApp.Repo
  • user_schema - the user schema to be used

    • the default is MyApp.Accounts.User

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.

Summary

Functions

Add a Phoenix token as a remember me cookie

Delete the remember_me cookie

Set the current_user variable

Functions

add_rem_cookie(conn, user_id, max_age \\ 2419200)

Add a Phoenix token as a remember me cookie.

delete_rem_cookie(conn)

Delete the remember_me cookie.

set_user(user, conn)

Set the current_user variable.