AuthenticationContext.AcquireTokenByAuthorizationCode Method (String, Uri, ClientAssertion)


Applies to: Version: 2.19.208020213, Platform: .NET Desktop.

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 AcquireTokenSilent.

Namespace:   Microsoft.IdentityModel.Clients.ActiveDirectory
Assembly:  Microsoft.IdentityModel.Clients.ActiveDirectory (in Microsoft.IdentityModel.Clients.ActiveDirectory.dll)

public AuthenticationResult AcquireTokenByAuthorizationCode(
	string authorizationCode,
	Uri redirectUri,
	ClientAssertion clientAssertion


Type: System.String

The authorization code received from service authorization endpoint.

Type: System.Uri

The redirect address used for obtaining authorization code.

Type: Microsoft.IdentityModel.Clients.ActiveDirectory.ClientAssertion

The client assertion to use for token acquisition.

Return Value

Type: Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult

It contains Access Token, Refresh Token and the Access Token's expiration time.

Return to top