public async Task <IActionResult> Index() { var tokenResponse = await ClientCredentials.GetAccessToken(); var claims = await ClientCredentials.CallApi(tokenResponse.AccessToken); return(View(claims)); }
public static async Task <ServiceClientCredentials> LogonWithEryphClient(ClientCredentials credentials, IEnumerable <string> scopes) { var scopesArray = scopes as string[] ?? scopes.ToArray(); var accessTokenResponse = await credentials.GetAccessToken(scopesArray).ConfigureAwait(false); return(new TokenCredentials(new ApplicationTokenProvider(credentials, accessTokenResponse, scopesArray))); }
static async Task Main(string[] args) { try { var tokenResponse = await ClientCredentials.GetAccessToken(); Console.WriteLine(tokenResponse.Json); var claims = await ClientCredentials.CallApi(tokenResponse.AccessToken); Console.WriteLine(claims); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public Task <AccessTokenResponse> AuthenticateAsync(string audience, IEnumerable <string> scopes) { return(_clientCredentials.GetAccessToken(scopes)); }