Content-Length: 291941 | pFad | http://github.com/flutter/flutter/issues/171704

38 [google_sign_in] Add discussion of exceptions to the migration guide · Issue #171704 · flutter/flutter · GitHub
Skip to content

[google_sign_in] Add discussion of exceptions to the migration guide #171704

@qeepcologne

Description

@qeepcologne

What package does this bug report belong to?

google_sign_in

What target platforms are you seeing this bug on?

Android

Have you already upgraded your packages?

Yes

Steps to reproduce

GoogleSignInAccount googleUser = await GoogleSignIn.instance.authenticate();
windows with selecting the google account opens
close that window

Expected results

migration guide should also mention:

GoogleSignIn.instance.authenticate() throws GoogleSignInException with code GoogleSignInExceptionCode.canceled

instead of
returning null

when the user closes the window/cancel the process

Code sample

Future<OAuthCredential?> _googleLoginCredential() async {
  try {
    final GoogleSignInAccount googleUser = await GoogleSignIn.instance.authenticate();
    final GoogleSignInAuthentication googleAuth = googleUser.authentication;
    return GoogleAuthProvider.credential(idToken: googleAuth.idToken);
  } catch  (e) {
    if (e is GoogleSignInException){
      if (e.code == GoogleSignInExceptionCode.canceled){
        return null;
      }
    }
    rethrow;
  }
}

Metadata

Metadata

Labels

P2Important issues not at the top of the work listd: api docsIssues with https://api.flutter.dev/p: google_sign_inThe Google Sign-In pluginpackageflutter/packages repository. See also p: labels.r: fixedIssue is closed as already fixed in a newer versionteam-ecosystemOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions









    ApplySandwichStrip

    pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


    --- a PPN by Garber Painting Akron. With Image Size Reduction included!

    Fetched URL: http://github.com/flutter/flutter/issues/171704

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy