Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Acquiring tokens with authorization codes

Navya Canumalla edited this page May 19, 2018 · 5 revisions

The Authorization Code flow is suitable when the application requires the user's interaction with the Azure AD STS during authentication. One such case is when users login to Web applications (web sites) using Open Id connect. The web application receives an authorization code which it can redeem to acquire a token for Web APIs.

Requests for authorization codes are delegated to the developer. To understand how to request an authorization code, see Authorization code flow.

Upon receiving an authorization code, any of the following acquireTokenByAuthorizationCode overrides can be called to request a token.

Returns Method
Future<AuthenticationResult> acquireTokenByAuthorizationCode(String authorizationCode, URI redirectUri, AsymmetricKeyCredential credential, AuthenticationCallback callback)
Future<AuthenticationResult> acquireTokenByAuthorizationCode(String authorizationCode, URI redirectUri, AsymmetricKeyCredential credential, String resource, AuthenticationCallback callback)
Future<AuthenticationResult> acquireTokenByAuthorizationCode(String authorizationCode, URI redirectUri, ClientAssertion clientAssertion, AuthenticationCallback callback)
Future<AuthenticationResult> acquireTokenByAuthorizationCode(String authorizationCode, URI redirectUri, ClientAssertion clientAssertion, String resource, AuthenticationCallback callback)
Future<AuthenticationResult> acquireTokenByAuthorizationCode(String authorizationCode, URI redirectUri, ClientCredential credential, AuthenticationCallback callback)
Future<AuthenticationResult> acquireTokenByAuthorizationCode(String authorizationCode, URI redirectUri, ClientCredential credential, String resource, AuthenticationCallback callback)

To see how to integrate the Authentication code flow into a web application, see Java web application sample.