Ash FrameworkAF
Ash Framework3y ago
162 replies
Blibs

Authentication actions as graphQL queries/mutations?

Is it possible to use AshGraphQL with AshAuthentication to sign_in and sign_up?

I've tried adding the sign_in_with_password action as a graphql query:
 graphql do
    type :user

    queries do
      get :sign_in_with_password, :sign_in_with_password
    end
  end


But this will ask for the user id as input, also it will not return the token, only the user.

What I wanted was to be able to do something like this:

mutation {
  signInWithPassword(email: "alice@prisma.io", password: "graphql") {
    token
    user {
      id,
      ...
    }
  }
}
Was this page helpful?