Hey Guys,
I am building a Nestjs Graphql Federation server and separate APIs as graphql microservices.
I have the following Microservices:
Gateway-service: Graphql Federation 2
Auth-service responsible for handling Auth tasks
Platform-service contains all the modules for business logic
and more.
okay here's what I'm thinking I would do:
In the API gateway it should check for basic token, validates it and routes to different services by placing the details from the token in the header.
Each service implements a simple gateway guard which basically does all the checks of those headers through a common module.
And then a separate auth service is used to handle register, login, MFA, device registration, sessions, admin access etc.
How about that?
Now one question I have is since we are checking for JWT at the gateway, how would I whitelist some queries or mutations at the gateway? like login itself as that will be at the auth service and if the gateway tries to check the token there then ofcourse it won't find it there so we need a use case where we can tell gateway which queries or mutations are whitelisted.
Now where can I add a directive or or decorator in the subgraph / microservice marking the graphql query in resolver public
So the gateway supergraph detects and does not perform its authentication.