AuthorizationCodeCredential Class
Authenticates by redeeming an authorization code previously obtained from Azure Active Directory.
See Azure Active Directory documentation for more information about the authentication flow.
- Inheritance
-
azure.identity._internal.get_token_mixin.GetTokenMixinAuthorizationCodeCredential
Constructor
AuthorizationCodeCredential(tenant_id: str, client_id: str, authorization_code: str, redirect_uri: str, **kwargs: Any)
Parameters
- tenant_id
- str
ID of the application's Azure Active Directory tenant. Also called its "directory" ID.
- redirect_uri
- str
The application's redirect URI. Must match the URI used to request the authorization code.
- authority
- str
Authority of an Azure Active Directory endpoint, for example "login.microsoftonline.com", the authority for Azure Public Cloud (which is the default). AzureAuthorityHosts defines authorities for other clouds.
- client_secret
- str
One of the application's client secrets. Required only for web apps and web APIs.
Methods
| close |
Close the credential's transport session. |
| get_token |
Request an access token for scopes. This method is called automatically by Azure SDK clients. The first time this method is called, the credential will redeem its authorization code. On subsequent calls the credential will return a cached access token or redeem a refresh token, if it acquired a refresh token upon redeeming the authorization code. |
close
Close the credential's transport session.
close() -> None
get_token
Request an access token for scopes.
This method is called automatically by Azure SDK clients.
The first time this method is called, the credential will redeem its authorization code. On subsequent calls the credential will return a cached access token or redeem a refresh token, if it acquired a refresh token upon redeeming the authorization code.
get_token(*scopes: str, **kwargs: Any) -> AccessToken
Parameters
- tenant_id
- str
optional tenant to include in the token request.
Return type
Exceptions
authentication failed. The error's message attribute gives a reason. Any error response from Azure Active Directory is available as the error's response attribute.
Feedback
Submit and view feedback for