private async Task <AuthenticationResult> AcquireTokenByUsernamePasswordAsync(IEnumerable <string> scopes, UsernamePasswordInput usernamePasswordInput) { Authority authority = Instance.Authority.CreateAuthority(ServiceBundle, Authority, ValidateAuthority); var requestParams = CreateRequestParameters(authority, scopes, null, UserTokenCache); var handler = new UsernamePasswordRequest( ServiceBundle, requestParams, ApiEvent.ApiIds.AcquireTokenWithScopeUser, usernamePasswordInput); return(await handler.RunAsync(CancellationToken.None).ConfigureAwait(false)); }
public async Task <AuthenticationResult> ExecuteAsync( AcquireTokenCommonParameters commonParameters, AcquireTokenByUsernamePasswordParameters usernamePasswordParameters, CancellationToken cancellationToken) { var requestContext = CreateRequestContextAndLogVersionInfo(commonParameters.CorrelationId); var requestParams = _publicClientApplication.CreateRequestParameters( commonParameters, requestContext, _publicClientApplication.UserTokenCacheInternal); var handler = new UsernamePasswordRequest( ServiceBundle, requestParams, usernamePasswordParameters); return(await handler.RunAsync(cancellationToken).ConfigureAwait(false)); }