Skip to content

🐛 Bug Report: [Android] Switching to any authenticator app while creating a Google OAuth Session breaks the login flow #181

@metalwings

Description

@metalwings

👟 Reproduction steps

Requirements

  • Google Account with an activated 2FA (two-factor-authentication) option
  • An android device which is logged into the same google account
  • appwrite project with Google OAuth setup

Reproduction

  1. Enable Google 2FA and make sure you are using an android device
  2. Login into your google account through createOAuth2Session(provider: "google")
  3. You switch to your 2FA application
  4. After confirming your 2FA, the login window is automatically closed but you're not logged in

Further information

Article how to add Google 2FA to your account: https://support.google.com/accounts/answer/185839

I've created a minimal reproduction repository:
https://gitlab.com/metalwings/appwrite-flutter-oauth2-demo

In my case the default "is this you?" screen is automatically shown by android as soon as I try to login into my account.

👍 Expected behavior

Switching to any authenticator app doesn't break the login flow.
Users should be able to switch to other app (in my case the default android auth by google, check my 2FA Code (or press "that's me") and login after I've completed the 2FA flow

👎 Actual Behavior

The login flow is cancelled due to loss of app focus.
An exception is thrown:

E/flutter ( 6554): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(CANCELED, User canceled login, null, null)
E/flutter ( 6554): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652:7)
E/flutter ( 6554): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310:18)
E/flutter ( 6554): <asynchronous suspension>
E/flutter ( 6554): #2      FlutterWebAuth2MethodChannel.authenticate 
(package:flutter_web_auth_2_platform_interface/method_channel/method_channel_flutter_web_auth_2.dart:16:7)

🎲 Appwrite version

Version 2.0.x
Appwrite Cloud
SDK Version 11

💻 Operating system

Linux

🧱 Your Environment

Problem can be reproduced in the appwrite cloud version

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions