AuthenticationContext.AcquireTokenByAuthorizationCode Method (String, Uri, ClientAssertionCertificate, String)
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)
Syntax
public AuthenticationResult AcquireTokenByAuthorizationCode(
string authorizationCode,
Uri redirectUri,
ClientAssertionCertificate clientCertificate,
string resource
)
Parameters
authorizationCode
Type: System.StringThe authorization code received from service authorization endpoint.
redirectUri
Type: System.UriThe redirect address used for obtaining authorization code.
clientCertificate
Type: Microsoft.IdentityModel.Clients.ActiveDirectory.ClientAssertionCertificateThe client certificate to use for token acquisition.
resource
Type: System.StringIdentifier of the target resource that is the recipient of the requested token. It can be null if provided earlier to acquire authorizationCode.
Return Value
Type: Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult
It contains Access Token, Refresh Token and the Access Token's expiration time.
See Also
AcquireTokenByAuthorizationCode Overload
AuthenticationContext Class
Microsoft.IdentityModel.Clients.ActiveDirectory Namespace
Return to top