-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 [FIREBASE_AUTH] Cannot sign in twice with phone number with the emulator #8351
Comments
Let's merge the discussion into firebase/firebase-tools#4290 |
I'm not sure if the issue comes from here or the emulator. The issue that I opened in the firebase-tools was originally about something else, ence why I'm issuing one here too as it seemed to fit better this repository. I don't usually ask the same issue in multiple repo. |
@cedvdb |
I will not furnish a stack trace because that would be misleading. the error is not what should be debugged, this error is essentially generated by me. There is no error happening on the flutterfire front. The error is essentially saying "hey there is no element in this array" because my repro tries to get the sms code from the emulator, but since the emulator did not generate a code, the array of code is empty. So an error happens because I try to access an element of an empty array. But the stack trace of this error is irrelevant, this is from my code: Future<String> retrieveSmsCode() async {
final Uri endpoint = Uri(
scheme: 'http',
host: '10.0.2.2', // android or localhost for other platforms
port: 9099,
path:
'emulator/v1/projects/${DefaultFirebaseOptions.android.projectId}/verificationCodes',
);
final response = await http.get(endpoint);
if (response.statusCode != 200) {
throw response.body;
}
Map body = jsonDecode(response.body);
final code = body['verificationCodes'].last['code']; //// here the error is thrown because the emulator did not generate an sms code
return code;
} Just to be clear, The bug is that no sms code is generated by the emulator. That could be because:
Is this more clear ? |
@darshankawar Do you need more information from me ? This is still in triage, that's why I'm asking. |
Thanks for the update. Keeping it open and labeling it for further insights from the team. /cc @russellwheatley |
Hey @cedvdb, as noted by @yuchenshi, this is a |
When using phone authentication with the firebase emulator and android emulator the authentication works the first time, the firebase emulator generates an sms code. The second time, if the login is fast enough, no such code is generated and the first code is invalidated.
When recording the below gif I noticed the code was actually generated the second time, it is because I did it slowly, keep watching as I tries to do it fast it will fail. Sorry if the gif is a bit slow, I was surprised to see it working at first.
I made a repro:
https://github.com/cedvdb/flutter_repros/tree/failing_auth
However it might require some setup:
firebase init
firebase_options.dart android
with the values for firebase config android.firebase emulators:start
This is blocking for integration testing
The text was updated successfully, but these errors were encountered: