Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it OK to pass on OAuth Access Token between services?

Considering the following scenario in a context of the SSO/OAuth/microservices:

  1. User successfully logs-in to the web application using OAuth's Implicit Flow.
  2. Web app requests some data from Service A and Service B passing on user's Access Token to authorize both requests.
  3. Service A also calls Service B (passing on the same Access Token!) in order to build response to the initial Web App request.

Now, is this OK to pass on the user's Access Token from Service A to Service B?

Or should Service A use "Client Credentials" grant to obtain its own Access Token to authorize call to the Service B?

UPDATE:
Please assume both services are owned by the same organization and both trust the same Authorization Server. Also both services are behind the same API Gateway which validates Access Tokens.

like image 507
begie Avatar asked Oct 03 '16 20:10

begie


People also ask

Is it OK to pass access token in URL?

So, if the client and the OAuth server both use https, would it be ok to send access tokens in url? Not really, URLs are still liable to be logged at the end server, which means the access token can still be leaked if an attacker was to get access to server logs. This is still susceptible to shoulder-surfing.

How sensitive is an OAuth access token?

The token is considered very sensitive information because it allows access to the service. Anyone could issue requests if they had this token. This is why the token is passed in the Authorization Header, this is why it's highly recommended you make all calls over https, to protect the headers and body information.

Is it possible to use the authentication token for multiple request?

Using the access token you be able to use the same token for multiple transactions as long as it is valid.

Can a token be shared?

Your authentication tokens should be: Private. Users can't share token authentication devices or pass them around between departments. Just as they wouldn't share passwords, they shouldn't share any other part of your security system.


1 Answers

It depends on who is controlling the web application, Service A and Service B. If they're all run by the same party there's no problem in passing the token on since it stays within the same security domain.

But if e.g. Service B is run by a 3rd party then things become problematic as the administrator of Service B can pickup the access token and call Service A as if it were your web application, potentially getting access to resources that it should not have access to.

You'll also note that if Service A and Service B are owned by 2 different parties, other than you, your web application should also obtain two different access tokens respectively for calling Service A and Service B to prevent the same security issue.

So the answer really is: it depends on who is controlling what i.e. if the token is crossing an administrative/security domain.

like image 133
Hans Z. Avatar answered Oct 07 '22 13:10

Hans Z.