FirebaseExtended/flutterfire_desktop

phone authentication not working

vishwajit76 opened this issue · 20 comments

After enter mobile number, blank windows opened and throw below exception.

Unhandled Exception: [firebase_auth/verification-canceled] Recaptcha verification process was canceled by user.

Could you provide minimal reproducible code?
What platform are you running on?
Did you try the example app first? Still same issue?

I tested on windows 10 platform,

ConfirmationResult? confirmationResult = await authController.getAuth.signInWithPhoneNumber( "+91" + mobileNumberController.text, );

I not test example app before.

Can you please try running the example app? let me know if the same problem appears there.

Another thing to try: The WebView used on Windows is Edge WebView2, could you please make sure you have the latest updated version of Edge on your Windows machine?

same problem in example app
image

Do you have the latest version of Microsoft Edge?
Check by opening Edge > Settings > About Microsoft Edge

Screen Shot 2022-03-10 at 3 47 34 PM

My assumption is that it's not connecting to a localhost server which is why the returned token is null causing this error to throw.

See here, can you put a breakpoint over this line and tell me if it's returning a result or not?

Could you try running the Dart CLI example by running this following from the root of flutterfire_desktop:

dart run packages/firebase_auth/firebase_auth_dart/example/bin/firebase_auth_dart_example.dart login

This should prompt you to enter a phone number, then will take you to the default browser for reCAPTCHA verification, which also runs on localhost, this will tell us if there's an issue with the localhost server on your machine.

got this error

D:\flutterfire_desktop-main>dart run packages/firebase_auth/firebase_auth_dart/example/bin/firebase_auth_dart_example.dart login
Error: Couldn't resolve the package 'ansicolor' in 'package:ansicolor/ansicolor.dart'.
Error: Couldn't resolve the package 'args' in 'package:args/args.dart'.
Error: Couldn't resolve the package 'cli_util' in 'package:cli_util/cli_logging.dart'.
Error: Couldn't resolve the package 'firebase_auth_dart' in 'package:firebase_auth_dart/firebase_auth_dart.dart'.
Error: Couldn't resolve the package 'firebase_core_dart' in 'package:firebase_core_dart/firebase_core_dart.dart'.
packages/firebase_auth/firebase_auth_dart/example/bin/firebase_auth_dart_example.dart:7:8: Error: Not found: 'package:ansicolor/ansicolor.dart'
import 'package:ansicolor/ansicolor.dart';
^
packages/firebase_auth/firebase_auth_dart/example/bin/firebase_auth_dart_example.dart:8:8: Error: Not found: 'package:args/args.dart'
import 'package:args/args.dart';
^
packages/firebase_auth/firebase_auth_dart/example/bin/firebase_auth_dart_example.dart:9:8: Error: Not found: 'package:cli_util/cli_logging.dart'
import 'package:cli_util/cli_logging.dart';
^
packages/firebase_auth/firebase_auth_dart/example/bin/firebase_auth_dart_example.dart:10:8: Error: Not found: 'package:firebase_auth_dart/firebase_auth_dart.dart'
import 'package:firebase_auth_dart/firebase_auth_dart.dart';
^
packages/firebase_auth/firebase_auth_dart/example/bin/firebase_auth_dart_example.dart:11:8: Error: Not found: 'package:firebase_core_dart/firebase_core_dart.dart'
import 'package:firebase_core_dart/firebase_core_dart.dart';
^

run dart pub get in packages/firebase_auth/firebase_auth_dart/example

Using cli successfully open webpage in browser. But at run time error was occured.

D:\flutterfire_desktop-main\packages\firebase_auth\firebase_auth_dart\example>dart run bin/firebase_auth_dart_example.dart login
Please login/register to continue
Email/Phone: +91823839XXXX
Attempting to sign in with phone number +91823839XXXX...

SMS Code: 777316
Signed in successfully! �

I'm not sure, since I'm unable to reproduce I cannot know where's the exact issue

same problem here

also it is happening with example project. By the way i updated my edge before that. White screen is opening instead of rechaptcha screen

any update?

Hey @vishwajit76, I pushed an update for Windows in the WebView plugin, it was aiming to fix a bug with Google Sign In but I think it might be related to this one as well.
Could you please clone the package desktop_webview_auth and run the example app, then try the ReCaptcha button, and let me know if you're still facing the same issue.

example project is working now but in my case after enter otp it show me firebase error

[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: [firebase_auth/invalid-auth] This user's credential isn't valid for this project. This can happen if the user's token has been tampered with, or if the user isn't for the project associated with this API key.
#0 ConfirmationResultDesktop.confirm (package:firebase_auth_desktop/src/confirmation_result.dart:25:7)

#1 ConfirmationResult.confirm (package:firebase_auth/src/confirmation_result.dart:33:7)

I used web app firebase configuration.

This happens when the token of the user is invalid, the good news is that it seems ReCaptcha issue is solved now. Make sure to clean any caches, and run flutter clean.

I have 2 questions:

  • The error happened in the example app in firebase_auth_desktop? if not, could you please clone a fresh copy from the repo and run it (it already has Firebase configurations).
  • Are you sure that the configurations you used are up-to-date and a fresh copy from a valid Firebase project?

After auth signOut it's working.