@InternalApi public class SessionCredentialsTokenSource extends Object implements TokenSource
Implements the refresh_token OAuth grant type with optional token caching.
| Constructor and Description |
|---|
SessionCredentialsTokenSource(Token token,
HttpClient hc,
String tokenUrl,
String clientId,
String clientSecret,
Optional<String> redirectUrl,
Optional<TokenCache> tokenCache)
Constructs a new SessionCredentialsTokenSource.
|
| Modifier and Type | Method and Description |
|---|---|
Token |
getToken()
Refreshes the OAuth token using the refresh_token grant type.
|
public SessionCredentialsTokenSource(Token token, HttpClient hc, String tokenUrl, String clientId, String clientSecret, Optional<String> redirectUrl, Optional<TokenCache> tokenCache)
token - The initial token to usehc - The HTTP client for making token refresh requeststokenUrl - The OAuth token endpoint URLclientId - The OAuth client IDclientSecret - The OAuth client secretredirectUrl - The OAuth redirect URL (optional)tokenCache - The token cache for persisting refreshed tokens (optional)public Token getToken()
This method attempts to refresh the current token using the refresh token. If successful, the new token is automatically saved to the token cache if one is configured. For Microsoft OAuth endpoints, it includes the Origin header.
getToken in interface TokenSourceToken with updated access and refresh tokens.DatabricksException - if the token is not set, refresh token is missing, or the refresh
request fails.Copyright © 2026. All rights reserved.