-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[google_sign_in_ios] Upgrade GoogleSignIn iOS SDK to 7.0 #5240
[google_sign_in_ios] Upgrade GoogleSignIn iOS SDK to 7.0 #5240
Conversation
*error = [FlutterError errorWithCode:@"missing-config" | ||
message:@"GoogleService-Info.plist file not found and clientId " | ||
@"was not provided programmatically." | ||
details:nil]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Google Sign In SDK now gets the configuration settings within the SDK itself from the Info.plist and that's now the preferred way to do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove the GoogleService-Info.plist
from the example then? We generally want the example to show the preferred approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, we should put an updated version of https://pub.dev/packages/google_sign_in#ios-integration into this package's README, and then update the main package README to point to that for iOS integration details. That's the pattern we are increasingly using for non-trivial setup docs in federated plugins (due to issues like this, where the setup steps actually depend on the version of the sub-package you are using).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI I moved GoogleService-Info.plist
from the Runner target to the RunnerTests target, so we can still use it for the example tests.
[self didSignInForUser:user withCompletion:completion error:error]; | ||
[self.signIn restorePreviousSignInWithCompletion:^(GIDGoogleUser *_Nullable user, | ||
NSError *_Nullable error) { | ||
[self didSignInForUser:user serverAuthCode:nil withCompletion:completion error:error]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may notice here I set serverAuthCode
to nil
. This is something I was unsure about. In previous version, the serverAuthCode
was a property of the user. However, in the new version, it's now a property of GIDSignInResult
, which you get when you sign in but not restore. I did confirm that in the old version on restore, the serverAuthCode
was included.
However, I think the new way where it doesn't include the serverAuthCode
is more inline with how OAuth works. Usually that code is a temporary one-time use code and then after that tokens are use to validate (see diagram in https://developers.google.com/identity/sign-in/web/server-side-flow).
[FlutterError errorWithCode:@"request_scopes" | ||
message:@"There is an operation on a previous " | ||
@"user. Try signing in again." | ||
details:nil]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, they removed kGIDSignInErrorCodeNoCurrentUser
as an error, I'm assuming because the method is now part of the GIDGoogleUser
class, so there has to be a user. They also added a new error kGIDSignInErrorCodeMismatchWithCurrentUser
, which I believe happens when GIDSignIn.currentUser doesn't match the user that makes this request. This shouldn't ever happen since we get the user from self.signIn.currentUser
, but I added a new error just in case.
packages/google_sign_in/google_sign_in_ios/ios/Classes/FLTGoogleSignInPlugin.h
Outdated
Show resolved
Hide resolved
Does this mean we are now stuck with the two-stage UI flow described here? |
I don't believe so, you can also request the scopes on initial sign in packages/packages/google_sign_in/google_sign_in_ios/ios/Classes/FLTGoogleSignInPlugin.m Lines 147 to 149 in 815fd8f
I think that was fixed in 6.2 (flutter/plugins#5708) |
😌
Right, I was afraid from that migration description that they had un-reversed that decision in 7 and were re-committing to separating authn and authz. |
packages/google_sign_in/google_sign_in_ios/example/ios/RunnerTests/GoogleSignInTests.m
Show resolved
Hide resolved
packages/google_sign_in/google_sign_in_ios/example/ios/RunnerTests/GoogleSignInTests.m
Show resolved
Hide resolved
packages/google_sign_in/google_sign_in_ios/example/ios/RunnerTests/GoogleSignInTests.m
Show resolved
Hide resolved
packages/google_sign_in/google_sign_in_ios/ios/Classes/FLTGoogleSignInPlugin.h
Outdated
Show resolved
Hide resolved
*error = [FlutterError errorWithCode:@"missing-config" | ||
message:@"GoogleService-Info.plist file not found and clientId " | ||
@"was not provided programmatically." | ||
details:nil]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove the GoogleService-Info.plist
from the example then? We generally want the example to show the preferred approach.
*error = [FlutterError errorWithCode:@"missing-config" | ||
message:@"GoogleService-Info.plist file not found and clientId " | ||
@"was not provided programmatically." | ||
details:nil]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, we should put an updated version of https://pub.dev/packages/google_sign_in#ios-integration into this package's README, and then update the main package README to point to that for iOS integration details. That's the pattern we are increasingly using for non-trivial setup docs in federated plugins (due to issues like this, where the setup steps actually depend on the version of the sub-package you are using).
@@ -281,7 +298,7 @@ - (void)didSignInForUser:(GIDGoogleUser *)user | |||
email:user.profile.email | |||
userId:user.userID | |||
photoUrl:[photoUrl absoluteString] | |||
serverAuthCode:user.serverAuthCode], | |||
serverAuthCode:serverAuthCode], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you audited the new API against the Dart types to see if we want any more changes here? The current situation is that we have optional types on various return objects (GoogleSignInUserData
, GoogleSignInTokenData
) and we populate what we can, which has varied from platform to platform and version to version. Notably, the release notes mention a new idToken
property on GIDGoogleUser
, and we have that on the Dart side, so it's very likely we should update the Pigeon FSIUserData
definition to include it, and then pass it back here and use it to populate that class on the Dart side here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idToken
was the only one from what I could tell.
packages/google_sign_in/google_sign_in_ios/ios/Classes/FLTGoogleSignInPlugin.m
Outdated
Show resolved
Hide resolved
…lue for dart type, fix scopes not being set, add more tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with nits. Thanks for doing this update!
@@ -6,5 +6,8 @@ | |||
|
|||
#import "messages.g.h" | |||
|
|||
#import <GoogleSignIn/GoogleSignIn.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this?
|
||
[self didSignInForUser:user | ||
serverAuthCode:serverAuthCode | ||
withCompletion:completion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: the with
should go on the first additional argument, so didSignInForUser:withServerAuthCode:completion:error:
.
* main: (59 commits) [pointer_interceptor] Move pointer_interceptor to sub folder (flutter#5291) [webview_flutter] Update iOS to Pigeon 13 (flutter#5271) [repo] Adjust error message layout for repo checks (flutter#5241) [in_app_pur]: Bump org.json:json from 20230618 to 20231013 in /packages/in_app_purchase/in_app_purchase/example/android/app (flutter#5153) Roll Flutter from f5a9835 to 5a6a322 (15 revisions) (flutter#5345) [google_sign_in_ios] Upgrade GoogleSignIn iOS SDK to 7.0 (flutter#5240) Roll Flutter from 29b2516 to f5a9835 (101 revisions) (flutter#5341) [pigeon]: Bump org.jetbrains.kotlin:kotlin-gradle-plugin from 1.9.10 to 1.9.20 in /packages/pigeon/platform_tests/test_plugin/android (flutter#5334) [flutter_markdown] Strip leading whitespace from list items (flutter#5294) [two_dimensional_scrollables] Add borderRadius support to TableSpanDecoration (flutter#5184) [go_router] Adds an ability to add a custom codec for serializing/des… (flutter#5288) [go_router] Fixes crashes when dynamically updates routing tables wit… (flutter#5242) [camerax] Fix `_getResolutionSelectorFromPreset` NPE (flutter#5287) [go_router]Fixes the problem what pathParameters is null in redirect when the Router is recreated. (flutter#5258) [google_sign_in] Fix Obj-C formatting bug (flutter#5310) Fix mounted checks (flutter#5305) [flutter_image] [flutter_markdown] Do not use dynamic in an == operator override (flutter#5298) [google_sign_in] Enable FedCM for web. Use token expiration. (flutter#5225) [video_player_web] Listen to loadedmetadata event from video element. (flutter#5289) [local_auth] Update iOS to Pigeon 13 (flutter#5269) ... # Conflicts: # packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m
flutter/packages@be18d28...94c7623 2023-11-07 louisehsu@google.com [pointer_interceptor] Move pointer_interceptor to sub folder (flutter/packages#5291) 2023-11-07 stuartmorgan@google.com [webview_flutter] Update iOS to Pigeon 13 (flutter/packages#5271) 2023-11-07 katelovett@google.com [repo] Adjust error message layout for repo checks (flutter/packages#5241) 2023-11-07 49699333+dependabot[bot]@users.noreply.github.com [in_app_pur]: Bump org.json:json from 20230618 to 20231013 in /packages/in_app_purchase/in_app_purchase/example/android/app (flutter/packages#5153) 2023-11-07 engine-flutter-autoroll@skia.org Roll Flutter from f5a9835 to 5a6a322 (15 revisions) (flutter/packages#5345) 2023-11-07 15619084+vashworth@users.noreply.github.com [google_sign_in_ios] Upgrade GoogleSignIn iOS SDK to 7.0 (flutter/packages#5240) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Fixes flutter/flutter#137140. See https://developers.google.com/identity/sign-in/ios/quick-migration-guide and https://developers.google.com/identity/sign-in/ios/release for info about changes made to the SDK.
Fixes flutter/flutter#137140.
See https://developers.google.com/identity/sign-in/ios/quick-migration-guide and https://developers.google.com/identity/sign-in/ios/release for info about changes made to the SDK.
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.