Do Microservices behind an API Gateway need to verify the Access Token

microservices

I have a bunch of microservices that are only accessible externally via an API Gateway.

My API Gateway is set up as an OAuth Resource and validates the token (Checks signature etc.) before passing the request downstream to one or more microservices.

Whilst my microservices need the token in order to verify scopes and claims, is there any need now for this service to validate the token as well?

It seems a bit overkill yet I cannot find any advice online about this scenario.

Is validating the token at the API gateway good enough? Or is it best practice to validate it again later?

Best Answer

If any internal calls can bypass the gateway either validate the token in every microservice, or force all calls — internal and external — to go through the gateway.

Personally I wouldn't trust internal calls either. Have them go through the gateway, even to the point of limiting traffic via firewall rules. Know who is talking to who, and why. This helps limit your surface of attack if someone ever breaches your network.

This does introduce a single point of failure, but this risk can be mitigated by load balancing servers and having fail-over servers on hand in case of catastrophic problems.

On the other hand if every service validates the token, and anything about the validation process changes you have N+1 services to update.