Created
December 6, 2017 16:20
-
-
Save HamidMosalla/c5f201c77f45651efa6c93245829c6cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<IActionResult> CallApiUsingClientCredentials() | |
{ | |
var tokenClient = new TokenClient("http://localhost:5000/connect/token", "mvc", "secret"); | |
var tokenResponse = await tokenClient.RequestClientCredentialsAsync("Api1"); | |
var client = new HttpClient(); | |
client.SetBearerToken(tokenResponse.AccessToken); | |
var content = await client.GetStringAsync("http://localhost:5001/api/resource-without-policy"); | |
return View("Json", content); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment