Skip to content

Instantly share code, notes, and snippets.

@HamidMosalla
Created December 6, 2017 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HamidMosalla/bef98a46c40556c834f137704a05fa56 to your computer and use it in GitHub Desktop.
Save HamidMosalla/bef98a46c40556c834f137704a05fa56 to your computer and use it in GitHub Desktop.
public async Task<IActionResult> CallApiUsingUserAccessToken()
{
var accessToken = await HttpContext.GetTokenAsync("access_token");
var client = new HttpClient();
client.SetBearerToken(accessToken);
var content = await client.GetStringAsync("http://localhost:5001/api/resource-with-policy");
return View("Json", content);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment