Ash FrameworkAF
Ash Framework•6mo ago•
124 replies
Yahya Oxley

Forbidden magic link

Can't get magic link to work all of a sudden. I receive the magic link in dev/mailbox but when I click it I'm taken to a page that has a "sign in" button, and once I click that, I get:

 [warning] Authentication failed: 
Bread Crumbs:
  > Error returned from: MyApp.Accounts.User.sign_in_with_magic_link

Forbidden Error

* Invalid magic_link token


Details: %AshAuthentication.Errors.AuthenticationFailed{
  caused_by: %Ash.Error.Forbidden{
    bread_crumbs: ["Error returned from: MyApp.Accounts.User.sign_in_with_magic_link"], 
    changeset: "#Changeset<>", 
    errors: [
      %AshAuthentication.Errors.InvalidToken{
        type: :magic_link,
        field: :token,
        splode: Ash.Error,
        bread_crumbs: ["Error returned from: MyApp.Accounts.User.sign_in_with_magic_link"],
        vars: [],
        path: [],
        stacktrace: #Splode.Stacktrace<>,
        class: :forbidden
      }
    ]
  },
  changeset: nil,
  field: nil,
  query: nil,
  strategy: %AshAuthentication.Strategy.MagicLink{
    identity_field: :email,
    lookup_action_name: :get_by_email,
    name: :magic_link,
    prevent_hijacking?: true,
    registration_enabled?: true,
    request_action_name: :request_magic_link,
    require_interaction?: true,
    resource: MyApp.Accounts.User,
    sender: {MyApp.Accounts.User.Senders.SendMagicLinkEmail, []},
    sign_in_action_name: :sign_in_with_magic_link,
    single_use_token?: true,
    token_lifetime: {10, :minutes},
    token_param_name: :token
  },
  splode: nil,
  bread_crumbs: [],
  vars: [],
  path: [],
  stacktrace: #Splode.Stacktrace<>,
  class: :forbidden
}
Was this page helpful?