I have several microservices(Springboot) which I have hosted on AWS. For example Lets assume Service1 and Service2 are two micro services. Service1 is the microservice which is accessed by frontend and mobile app. Service1 calls Service2. Service2 is completely internal.
I have setup Amazon API Gateway which sits infront of Service1. And I have Authentication(Oauth) configured using cognito.
All this is working. When calling from frontend/app, the request needs to be authenticated with the API Gateway, before reaching Service1.
But my question is If Service1 needs to communicate with Service2, what sort of Authentication would be best suited, considering I am using AWS
Can I resuse the token generated by API Gateway. So that Service1 can forward it to Service2 in its request and somehow Service2 verifies this with Gateway. Is it possible? If yes is it a good idea?
In some cases, Service1 communicates with Service2 without the request (cronjob) from frontend/app. In this case the communication doesn't go through API Gateway, hence there will be no token generated. How should I deal with case.
I do not want to introduce Oauth Authentication to authenticate between two internal microservices. I feel its a bit of a overkill. Is there a better approach?