次の方法で共有


ConfidentialClientApplication.AcquireTokenByAuthorizationCodeAsync Method

Definition

Caution

Use AcquireTokenByAuthorizationCode instead. See https://aka.ms/msal-net-3-breaking-changes.

[V2 API] Acquires a security token from the authority configured in the app using the authorization code previously received from the STS. It uses the OAuth 2.0 authorization code flow (See https://aka.ms/msal-net-authorization-code). It's usually used in web apps (for instance ASP.NET / ASP.NET Core web apps) which sign-in users, and therefore receive an authorization code. This method does not lookup the token cache, but stores the result in it, so it can be looked up using other methods such as AcquireTokenSilentAsync(IEnumerable<String>, IAccount).

[System.Obsolete("Use AcquireTokenByAuthorizationCode instead. See https://aka.ms/msal-net-3-breaking-changes. ", true)]
public System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult> AcquireTokenByAuthorizationCodeAsync (string authorizationCode, System.Collections.Generic.IEnumerable<string> scopes);
[<System.Obsolete("Use AcquireTokenByAuthorizationCode instead. See https://aka.ms/msal-net-3-breaking-changes. ", true)>]
abstract member AcquireTokenByAuthorizationCodeAsync : string * seq<string> -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>
override this.AcquireTokenByAuthorizationCodeAsync : string * seq<string> -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>
Public Function AcquireTokenByAuthorizationCodeAsync (authorizationCode As String, scopes As IEnumerable(Of String)) As Task(Of AuthenticationResult)

Parameters

authorizationCode
String

The authorization code received from service authorization endpoint.

scopes
IEnumerable<String>

Scopes requested to access a protected API

Returns

Authentication result containing token of the user for the requested scopes

Implements

Attributes

Applies to

See also