Lighthouse PHP : Return type depending on guard

13 views Asked by At

I have a backend API using GraphQL in a Laravel environment.

The authentication is splitted in 2 categories :

  • UserA
  • UserB

Each user has its own auth guard.

I would like to have a route "me" in my schema.graphql, however it must return either a UserA or a UserB (they don't have the same attributes at all), depending on the token.

How can I make this work ?

I tried creating 2 distincts routes, with 2 guards, but it doesn't work since we can have only one route with the same name.

0

There are 0 answers