Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IdentityPoolCredential does not work for text formatted credential source #815

Closed
whs opened this issue Dec 27, 2021 · 0 comments · Fixed by #822
Closed

IdentityPoolCredential does not work for text formatted credential source #815

whs opened this issue Dec 27, 2021 · 0 comments · Fixed by #822
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@whs
Copy link

whs commented Dec 27, 2021

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
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Dec 27, 2021
@lesv lesv added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed triage me I really want to be triaged. labels Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants