Microsoft.Identity.Client.PublicClientApplication.AcquireTokenAsync C# (CSharp) Method

AcquireTokenAsync() public method

public AcquireTokenAsync ( string scope ) : Task
scope string
return Task
        public async Task<AuthenticationResult> AcquireTokenAsync(string[] scope)
        {
            Authenticator authenticator = new Authenticator(this.Authority, this.ValidateAuthority, this.CorrelationId);
            return
                await
                    this.AcquireTokenCommonAsync(authenticator, scope, null, new Uri(this.RedirectUri), (string) null,
                        UiOptions.SelectAccount, null, null).ConfigureAwait(false);
        }

Same methods

PublicClientApplication::AcquireTokenAsync ( string scope, User user, UiOptions options, string extraQueryParameters ) : Task
PublicClientApplication::AcquireTokenAsync ( string scope, User user, UiOptions options, string extraQueryParameters, string additionalScope, string authority, string policy ) : Task
PublicClientApplication::AcquireTokenAsync ( string scope, string loginHint ) : Task
PublicClientApplication::AcquireTokenAsync ( string scope, string loginHint, UiOptions options, string extraQueryParameters ) : Task
PublicClientApplication::AcquireTokenAsync ( string scope, string loginHint, UiOptions options, string extraQueryParameters, string additionalScope, string authority, string policy ) : Task

Usage Example

コード例 #1
0
        protected override void ProcessRecord()
        {
            PublicClientApplication clientApplication =
                new PublicClientApplication(MSALPnPPowerShellClientId);

            // Acquire an access token for the given scope
            var authenticationResult = clientApplication.AcquireTokenAsync(Scopes).GetAwaiter().GetResult();

            // Get back the Access Token and the Refresh Token
            PnPAzureADConnection.AuthenticationResult = authenticationResult;
        }
All Usage Examples Of Microsoft.Identity.Client.PublicClientApplication::AcquireTokenAsync