title: Access Token/Authorization Between Microservices
body: <p>I'm creating an online store REST API that will mainly be used by a mobile app. The plan is for a microservices architecture using the Spring Cloud framework and Spring Cloud OAuth for security.</p>
  
  <p>My question is really on best practices for communication between microservices: Should I have each service register for their own token, or should they just pass the user's token around?</p>
  
  <p>For example, I have 3 services: user-service, account-service, order-service.
  I've been able to implement two procedures for creating an order: One passes the user's token around, and in the other each service gets their own token. I use Feign for both approaches.</p>
  
  <p>So for option 1: order-service -> GET account-service/account/current</p>
  
  <p>order-service calls the account-service which returns the account based on a userId in the token. Then the order-service creates an order for the account.</p>
  
  <p>Or for option 2: order-service -> GET account-service/account/user-id/{userId}</p>
  
  <p>order-service gets the userId from the sent token, calls the account-service with it's own token, then creates the order with the retrieved account.</p>
  
  <p>I'm really not sure which option is best to use. One better separates information but then requires two Feign Clients. However the other doesn't require the 2 clients and it becomes easier to block off end certain endpoints to outside clients, however it requires extra endpoints to be created and almost every service to go digging into the Authentication object.</p>
  
  <p>What are all your thoughts? Has anyone implemented their system in one way or another way entirely? Or perhaps I've got the completely wrong idea.</p>
  
  <p>Any help is appreciated.</p>