public class ExternalAccountAuthorizedUserCredentials extends GoogleCredentials
Obtaining the initial access and refresh token can be done through the Google Cloud CLI.
Example credentials file:
{
"type": "external_account_authorized_user",
"audience": "//iam.googleapis.com/locations/global/workforcePools/$WORKFORCE_POOL_ID/providers/$PROVIDER_ID",
"refresh_token": "refreshToken",
"token_url": "https://sts.googleapis.com/v1/oauthtoken",
"token_info_url": "https://sts.googleapis.com/v1/introspect",
"client_id": "clientId",
"client_secret": "clientSecret"
}
| Modifier and Type | Class and Description |
|---|---|
static class |
ExternalAccountAuthorizedUserCredentials.Builder
Builder for
ExternalAccountAuthorizedUserCredentials. |
OAuth2Credentials.CredentialsChangedListenerquotaProjectIdGOOGLE_DEFAULT_UNIVERSE| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
static ExternalAccountAuthorizedUserCredentials |
fromStream(InputStream credentialsStream)
Returns external account authorized user credentials defined by a JSON file stream.
|
static ExternalAccountAuthorizedUserCredentials |
fromStream(InputStream credentialsStream,
HttpTransportFactory transportFactory)
Returns external account authorized user credentials defined by a JSON file stream.
|
String |
getAudience() |
String |
getClientId() |
String |
getClientSecret() |
String |
getRefreshToken() |
String |
getRevokeUrl() |
String |
getTokenInfoUrl() |
String |
getTokenUrl() |
int |
hashCode() |
static ExternalAccountAuthorizedUserCredentials.Builder |
newBuilder() |
AccessToken |
refreshAccessToken()
Method to refresh the access token according to the specific type of credentials.
|
ExternalAccountAuthorizedUserCredentials.Builder |
toBuilder() |
String |
toString() |
create, create, createDelegated, createScoped, createScoped, createScoped, createScopedRequired, createWithCustomRetryStrategy, createWithQuotaProject, getAdditionalHeaders, getApplicationDefault, getApplicationDefault, getCredentialInfo, getQuotaProjectId, getUniverseDomain, isExplicitUniverseDomain, toStringHelperaddChangeListener, getAccessToken, getAuthenticationType, getFromServiceLoader, getRequestMetadata, getRequestMetadata, getRequestMetadataInternal, hasRequestMetadata, hasRequestMetadataOnly, newInstance, refresh, refreshIfExpired, removeChangeListenerblockingGetToCallback, getMetricsCredentialType, getRequestMetadatapublic static ExternalAccountAuthorizedUserCredentials fromStream(InputStream credentialsStream) throws IOException
Important: If you accept a credential configuration (credential JSON/File/Stream) from an external source for authentication to Google Cloud Platform, you must validate it before providing it to any Google API or library. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. For more information, refer to documentation.
credentialsStream - the stream with the credential definitionIOException - if the credential cannot be created from the streampublic static ExternalAccountAuthorizedUserCredentials fromStream(InputStream credentialsStream, HttpTransportFactory transportFactory) throws IOException
Important: If you accept a credential configuration (credential JSON/File/Stream) from an external source for authentication to Google Cloud Platform, you must validate it before providing it to any Google API or library. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. For more information, refer to documentation.
credentialsStream - the stream with the credential definitiontransportFactory - the HTTP transport factory used to create the transport to get access
tokensIOException - if the credential cannot be created from the streampublic AccessToken refreshAccessToken() throws IOException
OAuth2CredentialsThrows IllegalStateException if not overridden since direct use of OAuth2Credentials is only for temporary or non-refreshing access tokens.
refreshAccessToken in class OAuth2CredentialsIOExceptionpublic static ExternalAccountAuthorizedUserCredentials.Builder newBuilder()
public int hashCode()
hashCode in class GoogleCredentialspublic String toString()
toString in class GoogleCredentialspublic boolean equals(Object obj)
equals in class GoogleCredentialspublic ExternalAccountAuthorizedUserCredentials.Builder toBuilder()
toBuilder in class GoogleCredentialsCopyright © 2025 Google. All rights reserved.