title: Azure Mobile App refreshing tokens on server
body: <p>Here's the background:</p>
  
  <ul>
  <li>Need to authenticate with google/facebook/msa </li>
  <li>Need to add our own claims to <code>MobileServiceAuthenticationToken</code> for use on client </li>
  <li>Want to have refresh token capabilities (I know FB doesn't have that)</li>
  </ul>
  
  <p>I have this working by <code>LoginAsync</code> and getting a  <code>MobileServiceAuthenticationToken</code> back.  Then I call a custom auth controller which has an <code>[Authorize]</code> attribute on it.</p>
  
  <p>The custom auth controller copies some claims from the principal then adds our claims to those and creates a new token which it returns to the client.</p>
  
  <p>Using the <code>LoginAsync</code> for all of this keeps the tokens flowing for all calls and that's great.</p>
  
  <p>So, the token expires and I call <code>RefreshUserAsync</code> on the client.  At this point the <code>MobileServiceAuthenticationToken</code> with our custom claims is replaced by the default one from the MobileAppService without our claims.  I expect that.</p>
  
  <p>So now I have to call the custom auth controller again to get our claims added back to the identity token.  </p>
  
  <p>This works, but it feels clumsy.  And it's two round trips.</p>
  
  <p>What I'm looking for is to refresh the identity provider access token on the server side, and in the same method, update the identity token with our stuff.</p>
  
  <p>I'm aware of the <code>/.auth/refresh</code> call from the client side as an alternative to <code>RefreshUserAsync</code>.  Is there a similar call I can make from my controller in the backend without setting up the whole <code>System.Net.Http.HttpClient</code> thing?  </p>
  
  <p>For example: I use <code>this.User.GetAppServiceIdentityAsync&lt;GoogleCredentials&gt;( this.Request )</code> in the backend to get identity provider information without making HTTP calls.</p>
  
  <p>Something like that?</p>
  
  <p>Thanks in advance.</p>