2

Hello I am applying a microservices architecture, but I ran into a known problem such as authentication to my apis.

Since I have several microservices, I don't want to handle the authentication in each one of them so I implemented an api gateway with Ocelot for net core 3 to handle the requests.

I was looking at the documentation and it shows the following example from https://learn.microsoft.com/en-us/dotnet/architecture/microservices/multi-container-microservice-net-applications/implement-api-gateways-with-ocelot

enter image description here

In that example I understand that there is a service that generates the token (identity server) but I can't understand the logic. At login I will go to the identity server and it returns the token and I return it to the frontend, then for each request I send the token to the different microservices (A, B, C) through the gateway api, but how is it possible that the microservices know the token since it was generated in another independent service? What configuration should each microservice have so that it knows and detects the token generated from another service?

I have not found many examples for these cases, I was always used to handling authentication in monolithic applications using JWT. I would appreciate any advice or guidance.

Alonso Contreras
  • 605
  • 2
  • 12
  • 29

0 Answers0