AshAuthentication.Strategy.RememberMe.MaybeGenerateTokenPreparation (ash_authentication v4.13.3)

View Source

Maybe generate a remember me token and put it in the metadata of the resource to later be dropped as a cookie.

Add this to a sign action to support generating a remember me token.

Example:

  read :sign_in do
    ...
    argument :remember_me, :boolean do
      description "Whether to generate a remember me token."
      allow_nil? true
    end

    prepare AshAuthentication.Strategy.RememberMe.MaybeGenerateTokenPreparation
    # prepare {AshAuthentication.Strategy.RememberMe.MaybeGenerateTokenPreparation, strategy_name: :remember_me, argument: :remember_me}

    metadata :remember_me_token, :string do
      description "A remember me token that can be used to authenticate the user."
      allow_nil? false
    end
  end

Summary

Functions

init(opts)

Callback implementation for Ash.Resource.Preparation.init/1.

supports(opts)

Callback implementation for Ash.Resource.Preparation.supports/1.