Support for Single GraphQL Schema with Public and Authenticated APIs in Rebing GraphQL (Laravel) Using a Single Endpoint #1148
Replies: 1 comment
-
I faced a similar requirement, but that's what multiple schemas are for. With the current implementation, all queries & types exist in one "global state", so to have truly separate schema, you need to use separately named queries and types, unless you want an overlap. On my case, I define a Different schemas means I statically defined a different |
Beta Was this translation helpful? Give feedback.
-
I'm working on a Laravel project using the Rebing GraphQL package and have the following requirement:
Both public operations (like login and registration) and authenticated operations (protected APIs) should be accessible through a single GraphQL endpoint.
Public operations such as login and registration should not require the auth:api middleware.
Other operations should be protected by the auth:api middleware and accessible only to authenticated users.
Current Approach:
Currently, I have a single schema in graphql.php that contains both public and authenticated operations. However, I need to conditionally apply the auth:api middleware based on the type of operation (public or authenticated).
Config file:
Error:
Beta Was this translation helpful? Give feedback.
All reactions