Skip to content

IdentityPoolCredential does not work for text formatted credential source #815

@whs

Description

@whs

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Please run down the following list and make sure you've tried the usual "quick fixes":

If you are still having issues, please include as much information as possible:

subject_token_field_name is only valid for CredentialFormatType.JSON, but is also run on CredentialFormatType.TEXT which cause it to throw the exception:

credentialFormatType =
type.equals("text") ? CredentialFormatType.TEXT : CredentialFormatType.JSON;
if (!formatMap.containsKey("subject_token_field_name")) {
throw new IllegalArgumentException(
"When specifying a JSON credential type, the subject_token_field_name must be set.");
}
subjectTokenFieldName = formatMap.get("subject_token_field_name");

In the Python SDK, this line is if-checked to run only with JSON:

https://github.com/googleapis/google-auth-library-python/blob/3c3fbf40b07e090f2be7fac5b304dbf438b5cd6c/google/auth/identity_pool.py#L158-L165

Stack trace

java.lang.IllegalArgumentException","message":"When specifying a JSON credential type, the subject_token_field_name must be set.","stacktrace":"java.lang.IllegalArgumentException: When specifying a JSON credential type, the subject_token_field_name must be set.\n\tat com.google.auth.oauth2.IdentityPoolCredentials$IdentityPoolCredentialSource.<init>(IdentityPoolCredentials.java:144)\n\tat com.google.auth.oauth2.ExternalAccountCredentials.fromJson(ExternalAccountCredentials.java:319)\n\tat com.google.auth.oauth2.GoogleCredentials.fromStream(GoogleCredentials.java:170)\n\tat com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentialsUnsynchronized(DefaultCredentialsProvider.java:159)\n\tat com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentials(DefaultCredentialsProvider.java

Metadata

Metadata

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions