Skip to content

Conversation

@CaseyHillers
Copy link
Contributor

@CaseyHillers CaseyHillers commented Nov 8, 2019

The Flutter Google Sign In plugin should be getting official web support very soon. The open source fork the Flutter app was using did not get id tokens which required adding a new authentication method to the backend. This updates all the places in the Flutter app that reference the GoogleSignInService to use the new methods (using GoogleSignInAccount instead of separate fields).

Right now the web version is in the review stage, so this uses a forked version of it by the @ditman the PR owner.

Added ability to sign out by clicking the user avatar, and then clicking log out in the drop down.

Waiting on flutter/plugins#2266 and preferably flutter/plugins#2280

Preview

Demo available at http://testchillers.flutter-dashboard.appspot.com/v2/

logout screenshot

@CaseyHillers CaseyHillers changed the title [WIP] Use federated google sign in plugin [WIP] Switch to use federated google sign in plugin Nov 12, 2019
@CaseyHillers CaseyHillers changed the title [WIP] Switch to use federated google sign in plugin [WIP] Switch to federated google sign in plugin Nov 12, 2019
@CaseyHillers
Copy link
Contributor Author

All the plumbing is fixed, now I have to sort out how to get this dependency :)

@CaseyHillers CaseyHillers changed the title [WIP] Switch to federated google sign in plugin Switch to federated google sign in plugin Nov 15, 2019
Copy link
Contributor

@digiter digiter left a comment

Choose a reason for hiding this comment

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

The demo doesn't show avatar currently, is it expected?
The rest LGTM.

}

Future<void> signOut() async {
await _googleSignIn.signOut();
Copy link
Contributor

Choose a reason for hiding this comment

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

No action required, just want to mention that it's amusing to see "SignIn.signOut" :)

Comment on lines +39 to +41
url: git://github.com/ditman/plugins.git
ref: federated_google_sign_in_web
path: packages/google_sign_in/google_sign_in_web
Copy link
Member

Choose a reason for hiding this comment

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

I had no idea you could point to a repo+branch when using the git source. Nice!

Widget build(BuildContext context) {
if (authService.isAuthenticated) {
return PopupMenuButton<String>(
child: Image.network(authService.user.photoUrl),
Copy link
Member

Choose a reason for hiding this comment

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

There's a GoogleUserCircleAvatar widget provided by the google_sign_in plugin that you may be able to use. It's used in the example app.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using GoogleUserCircleAvatar would throw 2 exceptions in the tests, but I could only catch the last one with WidgetTester.takeException() and it would fail because the first was not caught. So for now, I am just going to leave a TODO :)

@CaseyHillers
Copy link
Contributor Author

The demo doesn't show avatar currently, is it expected?
The rest LGTM.

@digiter that was to be expected at that time. I have redeployed with latest code from David's fork, and that seems to be working. I noticed an issue where it isn't working in incognito mode (works in release mode on my chrome, dev mode, but not incognito mode release mode), and need to follow up with David before submitting.


/// Whether or not the application has been signed in to.
bool get isAuthenticated => user != null;
Future<bool> get isAuthenticated => _googleSignIn.isSignedIn();
Copy link
Member

Choose a reason for hiding this comment

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

If you don't want to change the getter signature you may be able to do:

bool get isAuthenticated => await _googleSignIn.isSignedIn();

Copy link
Member

Choose a reason for hiding this comment

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

(You might need to change it to an async fn, so maybe you still need to change the signature after all, hmmm)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The await expression can only be used in an async function.
Try marking the function body with either 'async' or 'async*'

@CaseyHillers CaseyHillers merged commit 794f5fd into flutter:master Nov 16, 2019
@CaseyHillers CaseyHillers deleted the google_sign_in branch November 16, 2019 01:05
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.

3 participants