AuthenticationContext.AcquireTokenByAuthorizationCodeAsync Method

Definition

Overloads

AcquireTokenByAuthorizationCodeAsync(String, Uri, IClientAssertionCertificate, String)

Acquires security token from the authority using an authorization code previously received. 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(String, String, UserIdentifier).

AcquireTokenByAuthorizationCodeAsync(String, Uri, IClientAssertionCertificate, String, Boolean)

In a Web App, attempts to acquire a security token from the authority using an authorization code previously received (after a call to one of the overrides of AcquireTokenByAuthorizationCodeAsync). For more details see https://aka.ms/adal-net-authorization-code. This method does not lookup token cache, but stores the result in it, so it can be looked up using other methods such as AcquireTokenSilentAsync(String, String, UserIdentifier).

AcquireTokenByAuthorizationCodeAsync(String, Uri, ClientCredential, String)

Acquires security token from the authority using an authorization code previously received. This method does not lookup token cache, but stores the result in it, so it can be looked up using other methods such as AcquireTokenSilentAsync(String, String, UserIdentifier).

AcquireTokenByAuthorizationCodeAsync(String, Uri, ClientAssertion)

Acquires security token from the authority using an authorization code previously received. 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(String, String, UserIdentifier).

AcquireTokenByAuthorizationCodeAsync(String, Uri, IClientAssertionCertificate)

Acquires security token from the authority using an authorization code previously received. 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(String, String, UserIdentifier).

AcquireTokenByAuthorizationCodeAsync(String, Uri, ClientCredential)

Acquires security token from the authority using authorization code previously received. This method does not lookup token cache, but stores the result in it, so it can be looked up using other methods such as AcquireTokenSilentAsync(String, String, UserIdentifier).

AcquireTokenByAuthorizationCodeAsync(String, Uri, ClientAssertion, String)

In a Web App, attemps to acquire a security token from the authority using an authorization code previously received (after a call to one of the overrides of AcquireTokenByAuthorizationCodeAsync). For more details see https://aka.ms/adal-net-authorization-code. This method does not lookup token cache, but stores the result in it, so it can be looked up using other methods such as AcquireTokenSilentAsync(String, String, UserIdentifier).

AcquireTokenByAuthorizationCodeAsync(String, Uri, IClientAssertionCertificate, String)

Acquires security token from the authority using an authorization code previously received. 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(String, String, UserIdentifier).

public System.Threading.Tasks.Task<Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult> AcquireTokenByAuthorizationCodeAsync (string authorizationCode, Uri redirectUri, Microsoft.IdentityModel.Clients.ActiveDirectory.IClientAssertionCertificate clientCertificate, string resource);
member this.AcquireTokenByAuthorizationCodeAsync : string * Uri * Microsoft.IdentityModel.Clients.ActiveDirectory.IClientAssertionCertificate * string -> System.Threading.Tasks.Task<Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult>
Public Function AcquireTokenByAuthorizationCodeAsync (authorizationCode As String, redirectUri As Uri, clientCertificate As IClientAssertionCertificate, resource As String) As Task(Of AuthenticationResult)

Parameters

authorizationCode
String

The authorization code received from service authorization endpoint.

redirectUri
Uri

The redirect address used for obtaining authorization code.

clientCertificate
IClientAssertionCertificate

The client certificate to use for token acquisition.

resource
String

Identifier of the target resource that is the recipient of the requested token. It can be null if provided earlier to acquire authorizationCode.

Returns

It contains Access Token, its expiration time, user information.

AcquireTokenByAuthorizationCodeAsync(String, Uri, IClientAssertionCertificate, String, Boolean)

In a Web App, attempts to acquire a security token from the authority using an authorization code previously received (after a call to one of the overrides of AcquireTokenByAuthorizationCodeAsync). For more details see https://aka.ms/adal-net-authorization-code. This method does not lookup token cache, but stores the result in it, so it can be looked up using other methods such as AcquireTokenSilentAsync(String, String, UserIdentifier).

public System.Threading.Tasks.Task<Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult> AcquireTokenByAuthorizationCodeAsync (string authorizationCode, Uri redirectUri, Microsoft.IdentityModel.Clients.ActiveDirectory.IClientAssertionCertificate clientCertificate, string resource, bool sendX5c);
member this.AcquireTokenByAuthorizationCodeAsync : string * Uri * Microsoft.IdentityModel.Clients.ActiveDirectory.IClientAssertionCertificate * string * bool -> System.Threading.Tasks.Task<Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult>
Public Function AcquireTokenByAuthorizationCodeAsync (authorizationCode As String, redirectUri As Uri, clientCertificate As IClientAssertionCertificate, resource As String, sendX5c As Boolean) As Task(Of AuthenticationResult)

Parameters

authorizationCode
String

The authorization code received from service authorization endpoint.

redirectUri
Uri

The redirect address used for obtaining authorization code.

clientCertificate
IClientAssertionCertificate

The client certificate to use for token acquisition.

resource
String

Identifier of the target resource that is the recipient of the requested token. It can be null if provided earlier to acquire authorizationCode.

sendX5c
Boolean

This parameter enables application developers to achieve easy certificates roll-over in Azure AD: setting this parameter to true will send the public certificate to Azure AD along with the token request, so that Azure AD can use it to validate the subject name based on a trusted issuer policy. This saves the application admin from the need to explicitly manage the certificate rollover (either via portal or powershell/CLI operation)

Returns

It contains Access Token, its expiration time, user information.

AcquireTokenByAuthorizationCodeAsync(String, Uri, ClientCredential, String)

Acquires security token from the authority using an authorization code previously received. This method does not lookup token cache, but stores the result in it, so it can be looked up using other methods such as AcquireTokenSilentAsync(String, String, UserIdentifier).

public System.Threading.Tasks.Task<Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult> AcquireTokenByAuthorizationCodeAsync (string authorizationCode, Uri redirectUri, Microsoft.IdentityModel.Clients.ActiveDirectory.ClientCredential clientCredential, string resource);
member this.AcquireTokenByAuthorizationCodeAsync : string * Uri * Microsoft.IdentityModel.Clients.ActiveDirectory.ClientCredential * string -> System.Threading.Tasks.Task<Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult>

Parameters

authorizationCode
String

The authorization code received from service authorization endpoint.

redirectUri
Uri

Address to return to upon receiving a response from the authority.

clientCredential
ClientCredential

The credential to use for token acquisition.

resource
String

Identifier of the target resource that is the recipient of the requested token. It can be null if provided earlier to acquire authorizationCode.

Returns

It contains Access Token, its expiration time, user information.

AcquireTokenByAuthorizationCodeAsync(String, Uri, ClientAssertion)

Acquires security token from the authority using an authorization code previously received. 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(String, String, UserIdentifier).

public System.Threading.Tasks.Task<Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult> AcquireTokenByAuthorizationCodeAsync (string authorizationCode, Uri redirectUri, Microsoft.IdentityModel.Clients.ActiveDirectory.ClientAssertion clientAssertion);
member this.AcquireTokenByAuthorizationCodeAsync : string * Uri * Microsoft.IdentityModel.Clients.ActiveDirectory.ClientAssertion -> System.Threading.Tasks.Task<Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult>

Parameters

authorizationCode
String

The authorization code received from service authorization endpoint.

redirectUri
Uri

The redirect address used for obtaining authorization code.

clientAssertion
ClientAssertion

The client assertion to use for token acquisition.

Returns

It contains Access Token, its expiration time, user information.

AcquireTokenByAuthorizationCodeAsync(String, Uri, IClientAssertionCertificate)

Acquires security token from the authority using an authorization code previously received. 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(String, String, UserIdentifier).

public System.Threading.Tasks.Task<Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult> AcquireTokenByAuthorizationCodeAsync (string authorizationCode, Uri redirectUri, Microsoft.IdentityModel.Clients.ActiveDirectory.IClientAssertionCertificate clientCertificate);
member this.AcquireTokenByAuthorizationCodeAsync : string * Uri * Microsoft.IdentityModel.Clients.ActiveDirectory.IClientAssertionCertificate -> System.Threading.Tasks.Task<Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult>
Public Function AcquireTokenByAuthorizationCodeAsync (authorizationCode As String, redirectUri As Uri, clientCertificate As IClientAssertionCertificate) As Task(Of AuthenticationResult)

Parameters

authorizationCode
String

The authorization code received from service authorization endpoint.

redirectUri
Uri

The redirect address used for obtaining authorization code.

clientCertificate
IClientAssertionCertificate

The client certificate to use for token acquisition.

Returns

It contains Access Token, its expiration time, user information.

AcquireTokenByAuthorizationCodeAsync(String, Uri, ClientCredential)

Acquires security token from the authority using authorization code previously received. This method does not lookup token cache, but stores the result in it, so it can be looked up using other methods such as AcquireTokenSilentAsync(String, String, UserIdentifier).

public System.Threading.Tasks.Task<Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult> AcquireTokenByAuthorizationCodeAsync (string authorizationCode, Uri redirectUri, Microsoft.IdentityModel.Clients.ActiveDirectory.ClientCredential clientCredential);
member this.AcquireTokenByAuthorizationCodeAsync : string * Uri * Microsoft.IdentityModel.Clients.ActiveDirectory.ClientCredential -> System.Threading.Tasks.Task<Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult>

Parameters

authorizationCode
String

The authorization code received from service authorization endpoint.

redirectUri
Uri

Address to return to upon receiving a response from the authority.

clientCredential
ClientCredential

The credential to use for token acquisition.

Returns

It contains Access Token, its expiration time, user information.

AcquireTokenByAuthorizationCodeAsync(String, Uri, ClientAssertion, String)

In a Web App, attemps to acquire a security token from the authority using an authorization code previously received (after a call to one of the overrides of AcquireTokenByAuthorizationCodeAsync). For more details see https://aka.ms/adal-net-authorization-code. This method does not lookup token cache, but stores the result in it, so it can be looked up using other methods such as AcquireTokenSilentAsync(String, String, UserIdentifier).

public System.Threading.Tasks.Task<Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult> AcquireTokenByAuthorizationCodeAsync (string authorizationCode, Uri redirectUri, Microsoft.IdentityModel.Clients.ActiveDirectory.ClientAssertion clientAssertion, string resource);
member this.AcquireTokenByAuthorizationCodeAsync : string * Uri * Microsoft.IdentityModel.Clients.ActiveDirectory.ClientAssertion * string -> System.Threading.Tasks.Task<Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult>

Parameters

authorizationCode
String

The authorization code received from service authorization endpoint.

redirectUri
Uri

The redirect address used for obtaining authorization code.

clientAssertion
ClientAssertion

The client assertion to use for token acquisition.

resource
String

Identifier of the target resource that is the recipient of the requested token. It can be null if provided earlier to acquire authorizationCode.

Returns

It contains Access Token, its expiration time, user information.

Applies to