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

Modify getUpdateMask to no longer ignore customClaims and sessionClaims #1184

Closed

Conversation

Metevier
Copy link

Description

Attempts to fix: #1135 - sessionClaims content not getting added to the decoded token

From my personal testing, adding sessionClaims or customerClaims through a blocking function does not work.
The emulator code is expecting both of these keys to show up in the updateMask of the blocking function's response.

https://github.com/firebase/firebase-tools/blob/30771f6498f32791cd2e88ac142611df58d32b7e/src/emulator/auth/operations.ts#L3083-L3117

I of course do not know what the internal firebase auth platform is expecting to receive in the updateMask, so these changes may not be the correct approach.

The test that is removed in the PR notes that the updateMask "should return empty on only customClaims and sessionClaims", and the consuming code will actually return an empty response if only the claims values are set:

const updateMask = getUpdateMask(authResponse);
const result =
updateMask.length === 0
? {}
: {
userRecord: {
...authResponse,
updateMask,
},
};

I do not see any mention of this requirement in the documentation: https://firebase.google.com/docs/auth/extend-with-blocking-functions

I am happy to update these fixes if the internal firebase auth implementation is expecting a different response (which will also require an update to the firebase-tools emulators).

@taeold
Copy link
Contributor

taeold commented Aug 24, 2022

@Metevier Thank you for your contribution and sorry we missed this PR.

We just merged an exact same fix this morning - #1199. We should've caught your PR request and merged it a month ago. I apologize for completely messing up here.

@taeold taeold closed this Aug 24, 2022
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.

sessionClaims content not getting added to the decoded token
2 participants