public async Task <TokenHolder> AuthenticateAsync() { var values = new Dictionary <string, string> { ["grant_type"] = "client_credentials", ["client_id"] = _clientId.ToInsecureString(), ["client_secret"] = _clientSecret.ToInsecureString(), ["scope"] = "openid " + _applicationScopes }; var tokenInfo = await OpenIdUtils.ExecuteTokenRequest(_httpClient, values); return(new TokenHolder(tokenInfo, _applicationScopes)); }
public async Task <TokenHolder> AuthenticateAsync() { var scopes = "email phone profile roles"; var values = new Dictionary <string, string> { ["grant_type"] = "password", ["username"] = _username.ToInsecureString(), ["password"] = _password.ToInsecureString(), ["scope"] = "openid offline_access " + scopes }; var tokenInfo = await OpenIdUtils.ExecuteTokenRequest(_httpClient, values); return(new TokenHolder(tokenInfo, scopes)); }