View Source EctoSessions.Session (Ecto Sessions v0.3.0)

Link to this section Summary

Functions

Session is an Ecto schema with

Link to this section Functions

Link to this macro

__using__(opts)

View Source (macro)

Session is an Ecto schema with:

  • id: a unique identifier of the session. This should be used by your application for internal purposes (ex: references, logs, etc), and not exposed to the end user.

  • auth_token_digest: Random hashed token (or not, according to the configuration).

  • auth_token: A virtual field available ony upon Session creation. It contains the plaintext version of the auth_token_digest.

  • data: any data that your application needs to store for this session. Ex: user id, device name or even ui theme.

  • Any other field defined under extra_fields. Ex: [ {:user_id, :string}, {:role, :string} ]

  • Virtual is_expired, true if the session is not expired.

By default if you have used EctoSessions in your project, import it with: alias MyApp.EctoSessions.Session