Hello,
Can sanctum works as jwt between microservices (adding data to token) to authenticate user in all mciroservices, if no, how to generate the jwt token from auth service and validate it in other MS. Should we use the same private and public key for All MS. So that all the generated tokens can be validate evreywhere in our microservices (as the jwt token being generated based on public private key) ? What is the best practice ?
Hey, if you google microservices architecture authentication you will find a lot if images/diagrams. you don't need to authenticate users in every microservice, you need a gateway
@Sergiu17 you mean the endpoint for the client will be the gateway and he will be authenticated only there, and the microservices will be without authentication open for gateway and closed for public? So any request from the gateway to the microservice is diffenetly authorized?
Microservices are basely running with Docker and Kubernetes,
I am not familiar with Kubernetes. But with Docker you can create Container to run the services, they can communicate with each other withIn the docker network without authenticate. your can only expose the gateway service api and do the authenticate there.
other way is create and event bus using redis to create redis steam, and the services grab the shared redis stream to listen the events.