AuthenticationContext.AcquireTokenByAuthorizationCodeAsync Method (String, Uri, ClientAssertionCertificate)

 

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

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

Syntax

public Task<AuthenticationResult> AcquireTokenByAuthorizationCodeAsync(
    string authorizationCode,
    Uri redirectUri,
    ClientAssertionCertificate clientCertificate
)

Parameters

  • authorizationCode
    Type: System.String

    The authorization code received from service authorization endpoint.

  • redirectUri
    Type: System.Uri

    The redirect address used for obtaining authorization code.

Return Value

Type: System.Threading.Tasks.Task<AuthenticationResult>

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

See Also

AcquireTokenByAuthorizationCodeAsync Overload
AuthenticationContext Class
Microsoft.IdentityModel.Clients.ActiveDirectory Namespace

Return to top