Closed GrandeSamarone closed 1 year ago
@GrandeSamarone Can you provide the complete error log along with a minimal code sample that is causing the reported behavior ?
@GrandeSamarone Você pode fornecer o log de erro completo junto com um exemplo de código mínimo que está causando o comportamento relatado?
as you can see I receive the code by SMS but I do not receive it in the app at credential.smsCode, it does not give verificationCompleted, it waits until it hits codeAutoRetrievalTimeout, it was normal before.
@override
Future<Map<String,dynamic>> verifyPhoneNumber(List<Object> objects) async {
final completer = Completer<Map<String,dynamic>>();
Map<String,dynamic> map={};
try {
await FirebaseAuth.instance.verifyPhoneNumber(
phoneNumber:objects[0].toString(),
timeout: const Duration(seconds: 60),
verificationCompleted: (PhoneAuthCredential credential)async {
map["error"]=false;
map["msg"]=credential.smsCode;
if(!completer.isCompleted){
completer.complete(map);
}
},
verificationFailed: (FirebaseAuthException e) {
print("verificationFailed");
print(e.code);
if (e.code == "invalid-phone-number") {
map["msg"]=Constants.txtNumberInvalid;
}else if(e.code=="too-many-requests"){
map["msg"]=Constants.txtNRequests;
}
map["error"]=true;
if(!completer.isCompleted){
completer.complete(map);
}
},
codeSent: (String verificationId, int? resendToken) {},
codeAutoRetrievalTimeout: (String verificationId) {
print("codeAutoRetrievalTimeout");
map["error"]=true;
map["msg"]=Constants.txtTimeisOver;
if(!completer.isCompleted){
completer.complete(map);
}
},
);
return completer.future;
} catch (e) {
throw ServerException;
}
}
I/PlayCore(32543): UID: [10834] PID: [32543] IntegrityService : requestIntegrityToken(IntegrityTokenRequest{nonce=PmBctXQok6OWGj0IR8eQIdDTrsOOQdXAEU-iSIjjwaw, cloudProjectNumber=551503664846})
I/PlayCore(32543): UID: [10834] PID: [32543] IntegrityService : Initiate binding to the service.
I/PlayCore(32543): UID: [10834] PID: [32543] IntegrityService : ServiceConnectionImpl.onServiceConnected(ComponentInfo{com.android.vending/com.google.android.finsky.integrityservice.IntegrityService})
I/PlayCore(32543): UID: [10834] PID: [32543] IntegrityService : linkToDeath
I/PlayCore(32543): UID: [10834] PID: [32543] OnRequestIntegrityTokenCallback : onRequestIntegrityToken
I/PlayCore(32543): UID: [10834] PID: [32543] IntegrityService : Unbind from service.
W/System (32543): Ignoring header X-Firebase-Locale because its value was null.
I/System.out(32543): [okhttp]:check permission begin!
I/System.out(32543): [okhttp]:not MMS!
I/System.out(32543): [okhttp]:not Email!
I/System.out(32543): [OkHttp] sendRequest<<
W/BpBinder(32543): Slow Binder: BpBinder transact took 347ms, interface=com.google.android.gms.auth.api.phone.internal.ISmsRetrieverApiService, code=1 oneway=false
E/FirebaseAuth(32543): [SmsRetrieverHelper] SMS verification code request failed: unknown status code: 18002 Invalid PlayIntegrity token; app not Recognized by Play Store.
D/FirebaseAuth(32543): Re-triggering phone verification with Recaptcha flow forced for phone number +55(69)99210-7870
I/zzf (32543): ForceRecaptchaFlow from phoneAuthOptions = true, ForceRecaptchaFlow from firebaseSettings = false
I/Timeline(32543): Timeline: Activity_launch_request time:457253048
W/Activity(32543): Slow Operation: Activity com.example.app_mtboyfogaca/com.google.firebase.auth.internal.RecaptchaActivity onResume took 112ms
V/PhoneWindow(32543): DecorView setVisiblity: visibility = 4, Parent = null, this = DecorView@9f1a534[]
W/System (32543): Ignoring header X-Firebase-Locale because its value was null.
D/ViewRootImpl[RecaptchaActivity](32543): hardware acceleration = true , fakeHwAccelerated = false, sRendererDisabled = false, forceHwAccelerated = false, sSystemRendererDisabled = false
I/System.out(32543): [okhttp]:check permission begin!
I/System.out(32543): [okhttp]:not MMS!
I/System.out(32543): [okhttp]:not Email!
I/InputTransport(32543): Create ARC handle: 0xb4000077d9ec5cc0
I/System.out(32543): [OkHttp] sendRequest>>
I/System.out(32543): [OkHttp] sendRequest<<
V/PhoneWindow(32543): DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@79de0a0, this = DecorView@9f1a534[RecaptchaActivity]
I/Timeline(32543): Timeline: Activity_launch_request time:457253577
I/PlayCore(32543): UID: [10834] PID: [32543] IntegrityService : reportBinderDeath
I/PlayCore(32543): UID: [10834] PID: [32543] IntegrityService : IntegrityService : Binder has died.
V/PhoneWindow(32543): DecorView setVisiblity: visibility = 4, Parent = android.view.ViewRootImpl@f17e107, this = DecorView@6252234[MainActivity]
V/PhoneWindow(32543): DecorView setVisiblity: visibility = 4, Parent = android.view.ViewRootImpl@79de0a0, this = DecorView@9f1a534[RecaptchaActivity]
I/GED (32543): ged_boost_gpu_freq, level 100, eOrigin 2, final_idx 31, oppidx_max 31, oppidx_min 0
W/System (32543): A resource failed to call end.
V/PhoneWindow(32543): DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@f17e107, this = DecorView@6252234[MainActivity]
V/PhoneWindow(32543): DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@79de0a0, this = DecorView@9f1a534[RecaptchaActivity]
V/PhoneWindow(32543): DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@f17e107, this = DecorView@6252234[MainActivity]
W/System (32543): Ignoring header X-Firebase-Locale because its value was null.
I/System.out(32543): [okhttp]:check permission begin!
I/System.out(32543): [okhttp]:not MMS!
I/System.out(32543): [okhttp]:not Email!
I/System.out(32543): [OkHttp] sendRequest<<
V/PhoneWindow(32543): DecorView setVisiblity: visibility = 4, Parent = android.view.ViewRootImpl@79de0a0, this = DecorView@9f1a534[RecaptchaActivity]
D/View (32543): [Warning] assignParent to null: this = DecorView@9f1a534[RecaptchaActivity]
I/InputTransport(32543): Destroy ARC handle: 0xb4000077d9ec5cc0
W/BpBinder(32543): Slow Binder: BpBinder transact took 419ms, interface=com.google.android.gms.auth.api.phone.internal.ISmsRetrieverApiService, code=1 oneway=false
W/FirebaseAuth(32543): [SmsRetrieverHelper] Timed out waiting for SMS.
I/flutter (32543): codeAutoRetrievalTimeout
Thanks for the update. Are you using any third party package implementations in your app ? Does the same behavior occur only using firebase_auth
and other related firebase plugins only ?
Obrigado pela atualização. Você está usando alguma implementação de pacote de terceiros em seu aplicativo? O mesmo comportamento ocorre apenas usando
firebase_auth
e outros plug-ins do firebase relacionados apenas?
I'm not using third-party plugins, only with firebase auth, I can't find the error and why the code doesn't reach the app
I made a new project just to test the auth phone and the result is the same, I'll show the settings
firebase_core: ^2.11.0
firebase_auth: ^4.5.0
firebase_app_check: ^0.1.4
ANDROID\build.gradle
classpath 'com.google.gms:google-services:4.3.15'
classpath 'com.android.tools.build:gradle:7.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
import 'package:firebase_app_check/firebase_app_check.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'firebase_options.dart';
void main()async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
await FirebaseAppCheck.instance.activate(
webRecaptchaSiteKey: 'recaptcha-v3-site-key',
androidProvider: AndroidProvider.debug,
);
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
verifyPhoneNumber("+55(69)992100000");
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headlineMedium,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
),
);
}
Future<void> verifyPhoneNumber(String number) async {
try {
await FirebaseAuth.instance.verifyPhoneNumber(
phoneNumber:number,
verificationCompleted: (PhoneAuthCredential credential)async {
print("verificationCompleted");
print(credential.smsCode);
},
verificationFailed: (FirebaseAuthException e) {
print("verificationFailed");
print(e.code);
},
codeSent: (String verificationId, int? resendToken) {},
codeAutoRetrievalTimeout: (String verificationId) {
print("codeAutoRetrievalTimeout");
},
);
} catch (e) {
print(e);
}
}
}
Is automatic verification only possible after you are in the store?
@GrandeSamarone Check below comments and see if they help in your case.
https://github.com/firebase/flutterfire/issues/4916#issuecomment-914239993
https://github.com/firebase/flutterfire/issues/4916#issuecomment-922274592
Also, [SmsRetrieverHelper] Timed out waiting for SMS.
seems to be coming from native SDK and not from client side, so you'll probably need to reach out to native Android sdk for further resolution. See this related issue for your reference:
https://github.com/firebase/firebase-android-sdk/issues/2688
Closing from here, as this doesn't seem to be actionable from flutterfire side. If you disagree, write in comments and I'll reopen it.
just answer my doubt, is it possible to test the automatic verification before sending it to the store?
Bug report
I'm receiving the code by sms like this in the image, and it's not in the app, I can't validate the code received and at the end it's timed out, what could it be? AppCheck and Google Play Integrity active in the project, Is there anything we have to add in the native? am I forgetting something?
Flutter doctor
Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 3.7.12, on Microsoft Windows [versÆo 10.0.22621.1555], locale pt-BR) [X] Windows Version (Unable to confirm if installed Windows version is 10 or greater) [!] Android toolchain - develop for Android devices (Android SDK version 30.0.3) ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses [√] Chrome - develop for the web [X] Visual Studio - develop for Windows X Visual Studio not installed; this is necessary for Windows development. Download at https://visualstudio.microsoft.com/downloads/. Please install the "Desktop development with C++" workload, including all of its default components [√] Android Studio (version 2022.2) [√] VS Code (version 1.77.3) [√] Connected device (4 available) [√] HTTP Host Availability
Flutter dependencies
dependencies:
dev dependencies:
transitive dependencies:
Dependencies Android
dependencies { implementation platform('com.google.firebase:firebase-bom:32.0.0') implementation 'com.google.firebase:firebase-messaging:23.1.2' implementation 'com.google.firebase:firebase-crashlytics:18.3.7' implementation 'androidx.browser:browser:1.5.0' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'com.google.firebase:firebase-auth:22.0.0' //implementation 'com.google.android.gms:play-services-safetynet:18.0.1' implementation 'androidx.cardview:cardview:1.0.0' implementation 'com.google.android.material:material:1.9.0' implementation 'com.google.code.gson:gson:2.9.1' implementation 'androidx.core:core:1.6.0' // (Java only) implementation "androidx.work:work-runtime:2.8.1" implementation ('io.socket:socket.io-client:2.1.0') { exclude group: 'org.json', module: 'json' } implementation 'com.google.guava:guava:27.0.1-android' implementation 'com.google.firebase:firebase-common-ktx:20.3.2'
}