Package com.azure.core.credential
Interface TokenCredential
- All Known Implementing Classes:
BasicAuthenticationCredential
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
The interface for credentials that can provide a token.
-
Method Summary
Modifier and TypeMethodDescriptiongetToken
(TokenRequestContext request) Asynchronously get a token for a given resource/audience.default AccessToken
getTokenSync
(TokenRequestContext request) Synchronously get a token for a given resource/audience.
-
Method Details
-
getToken
Asynchronously get a token for a given resource/audience. This method is called automatically by Azure SDK client libraries. You may call this method directly, but you must also handle token caching and token refreshing.- Parameters:
request
- the details of the token request- Returns:
- a Publisher that emits a single access token
-
getTokenSync
Synchronously get a token for a given resource/audience. This method is called automatically by Azure SDK client libraries. You may call this method directly, but you must also handle token caching and token refreshing.- Parameters:
request
- the details of the token request- Returns:
- The Access Token
-