diff --git a/AUTHORS b/AUTHORS index 31402c79d54a..3112c3b3fd05 100644 --- a/AUTHORS +++ b/AUTHORS @@ -68,3 +68,4 @@ Daniel Roek TheOneWithTheBraid Rulong Chen(陈汝龙) Hwanseok Kang +Twin Sun, LLC diff --git a/packages/google_sign_in/google_sign_in/AUTHORS b/packages/google_sign_in/google_sign_in/AUTHORS index 493a0b4ef9c2..35d24a5ae0b5 100644 --- a/packages/google_sign_in/google_sign_in/AUTHORS +++ b/packages/google_sign_in/google_sign_in/AUTHORS @@ -64,3 +64,4 @@ Aleksandr Yurkovskiy Anton Borries Alex Li Rahul Raj <64.rahulraj@gmail.com> +Twin Sun, LLC diff --git a/packages/google_sign_in/google_sign_in/CHANGELOG.md b/packages/google_sign_in/google_sign_in/CHANGELOG.md index 286365ef9601..93497841fbd5 100644 --- a/packages/google_sign_in/google_sign_in/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in/CHANGELOG.md @@ -1,6 +1,8 @@ -## NEXT +## 5.4.2 * Updates minimum Flutter version to 2.10. +* Adds override for `GoogleSignInPlatform.initWithParams`. +* Fixes tests to recognize new default `forceCodeForRefreshToken` request attribute. ## 5.4.1 diff --git a/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart b/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart index 135c422adfb5..3ae022306fe6 100644 --- a/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart +++ b/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart @@ -179,12 +179,16 @@ class GoogleSignIn { /// The [hostedDomain] argument specifies a hosted domain restriction. By /// setting this, sign in will be restricted to accounts of the user in the /// specified domain. By default, the list of accounts will not be restricted. + /// + /// The [forceCodeForRefreshToken] is used on Android to ensure the authentication + /// code can be exchanged for a refresh token after the first request. GoogleSignIn({ this.signInOption = SignInOption.standard, this.scopes = const [], this.hostedDomain, this.clientId, this.serverClientId, + this.forceCodeForRefreshToken = false, }); /// Factory for creating default sign in user experience. @@ -250,6 +254,9 @@ class GoogleSignIn { /// server. final String? serverClientId; + /// Force the authorization code to be valid for a refresh token every time. Only needed on Android. + final bool forceCodeForRefreshToken; + final StreamController _currentUserController = StreamController.broadcast(); @@ -286,6 +293,7 @@ class GoogleSignIn { hostedDomain: hostedDomain, clientId: clientId, serverClientId: serverClientId, + forceCodeForRefreshToken: forceCodeForRefreshToken, )) ..catchError((dynamic _) { // Invalidate initialization if it errors out. diff --git a/packages/google_sign_in/google_sign_in/pubspec.yaml b/packages/google_sign_in/google_sign_in/pubspec.yaml index 50339902fe75..c32dee78468b 100644 --- a/packages/google_sign_in/google_sign_in/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in/pubspec.yaml @@ -3,7 +3,7 @@ description: Flutter plugin for Google Sign-In, a secure authentication system for signing in with a Google account on Android and iOS. repository: https://github.com/flutter/plugins/tree/main/packages/google_sign_in/google_sign_in issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22 -version: 5.4.1 +version: 5.4.2 environment: @@ -23,8 +23,8 @@ flutter: dependencies: flutter: sdk: flutter - google_sign_in_android: ^6.0.0 - google_sign_in_ios: ^5.4.0 + google_sign_in_android: ^6.1.0 + google_sign_in_ios: ^5.5.0 google_sign_in_platform_interface: ^2.2.0 google_sign_in_web: ^0.10.0 diff --git a/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart b/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart index b8676bda298e..b8a596b02065 100644 --- a/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart +++ b/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart @@ -80,6 +80,16 @@ void main() { verify(mockPlatform.signIn()); }); + test('forceCodeForRefreshToken sent with init method call', () async { + final GoogleSignIn googleSignIn = + GoogleSignIn(forceCodeForRefreshToken: true); + + await googleSignIn.signIn(); + + _verifyInit(mockPlatform, forceCodeForRefreshToken: true); + verify(mockPlatform.signIn()); + }); + test('signOut', () async { final GoogleSignIn googleSignIn = GoogleSignIn();