Skip to content

Conversation

stuartmorgan-g
Copy link
Collaborator

Fixes an issue where serverAuthorizationTokensForScopes would usually return the results of getRefreshedAuthorizationTokens directly, even though getRefreshedAuthorizationTokens will never include a server auth code. Now, the server auth code is cached when it is returned from authn steps, so that it can be returned when it is requested, since those are different APIs in this plugin (unlike the underlying SDK on iOS).

Fixes flutter/flutter#175313

Pre-Review Checklist

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2 3

Fixes an issue where `serverAuthorizationTokensForScopes` would usually
return the results of `getRefreshedAuthorizationTokens` directly, even
though `getRefreshedAuthorizationTokens` will never include a server
auth code. Now, the server auth code is cached when it is returned from
authn steps, so that it can be returned when it is requested, since
those are different APIs in this plugin (unlike the underlying SDK on
iOS).

Fixes flutter/flutter#175313
Copy link

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

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 fixes an issue on iOS where serverAuthorizationTokensForScopes would incorrectly return null. The fix introduces caching for the server authorization code, ensuring it's available for later calls. The implementation is sound, correctly handling user changes by associating the cached code with a user ID. The accompanying tests are thorough, covering the new caching logic and various edge cases. I've added one suggestion to improve the readability of a new test case.

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

Successfully merging this pull request may close these issues.

[google_sign_in] server code request on iOS docs
1 participant