Skip to content

Instantly share code, notes, and snippets.

@ahey
ahey / confirm_with_token.ex
Created October 11, 2023 05:07
Using ash and ash_authentication, configure a user resource for auth via GraphQL
defmodule YourApp.User.Actions.ConfirmWithToken do
use Ash.Resource.ManualCreate
def create(changeset, _opts, _context) do
strategy = AshAuthentication.Info.strategy!(YourApp.User, :confirm)
AshAuthentication.Strategy.action(
strategy,
:confirm,
%{"confirm" => changeset.arguments[:token]}