Skip to content

Fix a small bug in setCustomUserClaims() auth snippet #747

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

Merged
merged 2 commits into from
Dec 13, 2022

Conversation

NhienLam
Copy link
Contributor

@NhienLam NhienLam commented Dec 8, 2022

I was testing the code snippets in FirebaseAuthSnippets.java, which would be used this doc https://cloud.google.com/identity-platform/docs/multi-tenancy-managing-tenants#controlling_access_with_custom_claims. When testing the setCustomUserClaims(), I got an USER_NOT_FOUND error.
"No user record found for the given identifier (USER_NOT_FOUND)."

I believe this error happens because FirebaseAuth.getInstance() doesn’t specify which tenant we are setting.
Therefore, using TenantAwareAuth instance for the corresponding tenant tenantAuth instead of FirebaseAuth.getInstance() fixes the issue.

Copy link
Member

@lahirumaramba lahirumaramba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @NhienLam ! LGTM!

@NhienLam NhienLam merged commit f0d6f49 into master Dec 13, 2022
@lahirumaramba lahirumaramba deleted the nhienlam-auth-snippet branch December 13, 2022 18:29
@lahirumaramba
Copy link
Member

@NhienLam
Copy link
Contributor Author

@lahirumaramba Thanks for approving the PR!

Should we also add Java code samples to https://cloud.google.com/identity-platform/docs/multi-tenancy-managing-tenants#controlling_access_with_custom_claims ?
There is a CL that adds Java code samples to this doc. I was testing these code snippets while reviewing that CL. I will comment on that CL to tell the author to use the new setCustomUserClaimsTenant() which I added. Hopefully, that CL will be merged and the doc will be updated soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants