Skip to content

[google_sign_in_android] Update android libraries#11694

Open
davidmartos96 wants to merge 4 commits into
flutter:mainfrom
davidmartos96:update_google_sign_in_credentials
Open

[google_sign_in_android] Update android libraries#11694
davidmartos96 wants to merge 4 commits into
flutter:mainfrom
davidmartos96:update_google_sign_in_credentials

Conversation

@davidmartos96
Copy link
Copy Markdown
Contributor

@davidmartos96 davidmartos96 commented May 12, 2026

Updates the Google Credentials dependencies

Fixes flutter/flutter#186395

This piece of code has been updated as the requestOfflineAccess method was deprecated: https://developers.google.com/android/reference/com/google/android/gms/auth/api/identity/AuthorizationRequest.Builder#public-authorizationrequest.builder-requestofflineaccess-string-serverclientid,-boolean-forcecodeforrefreshtoken
image

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

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

@flutter-dashboard
Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

Copy link
Copy Markdown

@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 updates the google_sign_in_android package to version 7.2.11, bumping several Android dependencies including AndroidX Credentials, Play Services Auth, and Android Identity GoogleID. The authorize implementation in GoogleSignInPlugin.java is updated to use setPrompt for forced refresh tokens, replacing a deprecated requestOfflineAccess method. Review feedback suggests extracting the server client ID to a local variable for improved readability and ensuring the logic changes are documented in the CHANGELOG.

Comment on lines +386 to +388
authorizationRequestBuilder.requestOfflineAccess(params.getServerClientIdForForcedRefreshToken());
// This requests a new refresh token
authorizationRequestBuilder.setPrompt(AuthorizationRequest.Prompt.CONSENT);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The migration from the deprecated requestOfflineAccess(String, boolean) to requestOfflineAccess(String) and setPrompt(AuthorizationRequest.Prompt.CONSENT) is correct for forcing a refresh token. However, for better readability and to avoid multiple calls to the getter, consider extracting the server client ID to a local variable.

        String serverClientId = params.getServerClientIdForForcedRefreshToken();
        if (serverClientId != null) {
          authorizationRequestBuilder.requestOfflineAccess(serverClientId);
          // This requests a new refresh token
          authorizationRequestBuilder.setPrompt(AuthorizationRequest.Prompt.CONSENT);
        }

Comment on lines +3 to +5
* Bumps AndroidX Credentials to v1.6.0
* Bumps Play Services Auth to v21.5.1
* Bumps Android Identity GoogleID to v1.2.0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

While the dependency bumps are listed, the logic change in GoogleSignInPlugin.java (migrating to setPrompt for forced refresh tokens) should also be mentioned in the CHANGELOG to inform users of the implementation update, even if the intended behavior remains the same.

Suggested change
* Bumps AndroidX Credentials to v1.6.0
* Bumps Play Services Auth to v21.5.1
* Bumps Android Identity GoogleID to v1.2.0
* Bumps AndroidX Credentials to v1.6.0
* Bumps Play Services Auth to v21.5.1
* Bumps Android Identity GoogleID to v1.2.0
* Updates `authorize` implementation to use `setPrompt` for forced refresh tokens.

@stuartmorgan-g stuartmorgan-g added the triage-android Should be looked at in Android triage label May 12, 2026
@stuartmorgan-g stuartmorgan-g requested a review from reidbaker May 12, 2026 18:23
@reidbaker reidbaker added the CICD Run CI/CD label May 12, 2026
@reidbaker
Copy link
Copy Markdown
Contributor

Hey @davidmartos96 what manual testing (if any) did you do as part of this pr?

@github-actions github-actions Bot removed the CICD Run CI/CD label May 13, 2026
@davidmartos96
Copy link
Copy Markdown
Contributor Author

davidmartos96 commented May 13, 2026

@reidbaker Hello! I've tested it with my own app that integrates Google Sign In, but I've also copied the example code and tried it out, including the generation of the server auth code.

Sign In, Request scopes, Server auth code and SIgn Out

@reidbaker reidbaker added the CICD Run CI/CD label May 13, 2026
@reidbaker
Copy link
Copy Markdown
Contributor

@davidmartos96 awesome I will get this reviewed today.

if (params.getServerClientIdForForcedRefreshToken() != null) {
authorizationRequestBuilder.requestOfflineAccess(
params.getServerClientIdForForcedRefreshToken(), true);
params.getServerClientIdForForcedRefreshToken());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For future me if I need to look at this pr.
Here is the changelog that matters (I initially started with jetpack credential manager)
https://developers.google.com/android/guides/releases#january_07_2026

This pr is doing exactly what the documentation suggests. https://developers.google.com/android/reference/com/google/android/gms/auth/api/identity/AuthorizationRequest.Builder#requestOfflineAccess(java.lang.String,%20boolean)

Copy link
Copy Markdown
Contributor

@reidbaker reidbaker left a comment

Choose a reason for hiding this comment

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

Comment added for how to fix presubmit issues.

@github-actions github-actions Bot removed the CICD Run CI/CD label May 14, 2026
@davidmartos96 davidmartos96 requested a review from reidbaker May 14, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p: google_sign_in platform-android triage-android Should be looked at in Android triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update AndroidX Google Credentials dependencies

3 participants