title: How to Get UserToken in APIController class and associate it with other service principal for calling other APIS
body: <p>I have created an Azure API App and associated this with Azure service principal . In the controller (derived from <code>APIController</code> Class), I put the authorize attribute on class level and user is getting a login page while accessing the api. Now I want to access some azure resource from Azure API. I am using below code for getting the token </p>
  
  <pre><code>string tenant = "***********";
  string aadInstance = "*********";
  
  string authority = String.Format(CultureInfo.InvariantCulture, aadInstance, tenant);
  
  var authContext = new AuthenticationContext(authority);
  var clientCredential = new ClientCredential("*********", "*****");
  
  var authResult = authContext.AcquireTokenAsync("https://database.windows.net/", clientCredential);
  return authResult.Result.AccessToken;
  </code></pre>
  
  <p>I am getting the token , but I think this token is not generated in the context of the logged in user. There is one overload of <code>AcquireTokenAsync</code> method which is taking <code>UserAssertion</code> Parameter but I am not sure , how can I set it from the values that I am getting in <code>APIController</code> class.</p>
  
  <p>Thanks,</p>
  
  <p>Abhishek </p>