예제 #1
0
        private async Task <AccessToken> GetTokenViaBrowserLoginAsync(string[] scopes, bool async, CancellationToken cancellationToken)
        {
            AuthenticationResult result = await Client.AcquireTokenInteractiveAsync(scopes, Prompt.SelectAccount, async, cancellationToken).ConfigureAwait(false);

            Record = new AuthenticationRecord(result, ClientId);

            return(new AccessToken(result.AccessToken, result.ExpiresOn));
        }
예제 #2
0
        private async Task <AccessToken> GetTokenViaBrowserLoginAsync(TokenRequestContext context, bool async, CancellationToken cancellationToken)
        {
            Prompt prompt = LoginHint switch
            {
                null => Prompt.SelectAccount,
                _ => Prompt.NoPrompt
            };

            var tenantId = TenantIdResolver.Resolve(_tenantId ?? Record?.TenantId, context, _allowMultiTenantAuthentication);
            AuthenticationResult result = await Client
                                          .AcquireTokenInteractiveAsync(context.Scopes, context.Claims, prompt, LoginHint, tenantId, async, cancellationToken)
                                          .ConfigureAwait(false);

            Record = new AuthenticationRecord(result, ClientId);
            return(new AccessToken(result.AccessToken, result.ExpiresOn));
        }
    }