Skip to content

Move granted scopes, configuration and profile into the snapshot - #651

Merged
w-goog merged 6 commits into
mainfrom
fix/googleuser-snapshot-scopes-config-profile
Oct 20, 2026
Merged

w-goog merged 6 commits into
mainfrom
fix/googleuser-snapshot-scopes-config-profile

Conversation

@w-goog

@w-goog w-goog commented Oct 15, 2026

Copy link
Copy Markdown
Contributor
  • Move grantedScopes, configuration, and profile to the token snapshot. With this change, readers can no longer see new profile + old tokens.
  • profile now sends KVO notifications when it changes (it sent none before).
  • configuration is now fixed at user creation. This closes a gap where GTMAppAuth refreshes may accidentally overwrite the audience or openid.realm with empty values. I'll fully address the remaining gap in restorePreviousSignIn in a future PR.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request refactors GIDGoogleUser to include grantedScopes, configuration, and profile in the immutable GIDGoogleUserTokens snapshot, resolving data races and ensuring consistent KVO notifications. The configuration is now computed once and remains fixed for the user's lifetime, and unit tests have been added to verify these behaviors. The review feedback suggests improving the change detection logic in updateTokensWithAuthState: by using isEqual: instead of pointer comparison for the profile object to prevent redundant updates, and optimizing the scopes comparison with a pointer equality fast path.

Comment thread GoogleSignIn/Sources/GIDGoogleUser.m Outdated
Comment thread GoogleSignIn/Sources/GIDGoogleUser.m Outdated
Comment thread GoogleSignIn/Sources/GIDGoogleUser.m
Comment thread GoogleSignIn/Sources/GIDGoogleUser.m
Comment thread GoogleSignIn/Sources/GIDGoogleUser.m Outdated
Comment thread GoogleSignIn/Sources/GIDGoogleUser.m Outdated
Comment thread GoogleSignIn/Sources/GIDGoogleUser.m Outdated
@w-goog
w-goog added this pull request to stack #654 October 15, 2026 22:48
@w-goog
w-goog force-pushed the fix/googleuser-snapshot-scopes-config-profile branch from 6192c1e to 410ed2c Compare October 15, 2026 23:11
@w-goog
w-goog requested a review from yalkhder October 16, 2026 19:29
Comment thread GoogleSignIn/Sources/GIDGoogleUser.m Outdated
Comment thread GoogleSignIn/Sources/GIDGoogleUser.m
@w-goog
w-goog requested a review from yalkhder October 19, 2026 18:56
@w-goog
w-goog merged commit 86fc6fa into main Oct 20, 2026
33 of 34 checks passed
@w-goog
w-goog deleted the fix/googleuser-snapshot-scopes-config-profile branch October 20, 2026 16:06
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.

2 participants