0
votes

Okay, hopefully quick question, but for some reason in my current project, the call to actually create and set my verificationId from firebase_auth doesn't ever seem to get called.

Code Snippet involved.

final PhoneCodeSent smsCodeSent = (String verID, [int forceCodeResent]) async {
   this.verificationId = verID;
   print('Setting verificationId');
};

print('Creating Verification Code for: ' + this.phoneNumber);
await _auth.verifyPhoneNumber(
  phoneNumber: this.phoneNumber, 
  codeAutoRetrievalTimeout: timeout,
  codeSent: smsCodeSent,
  timeout: const Duration(seconds: 20),
  verificationCompleted: verificationComplete,
  verificationFailed: verificationFailed,
);

print(this.verificationId);

}

I DO see the print for the phone number (Whatever phone number is input by the user) but the output log only shows:

flutter: Creating Verification Code for: 5555555555 flutter: null

Meaning that the smsCodeSent function is never called. Any ideas why?

(Results of Flutter Doctor to follow)

[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale en-CA) • Flutter version 1.12.13+hotfix.5 at /Users/iosdev/Developer/flutter • Framework revision 27321ebbad (3 weeks ago), 2019-12-10 18:15:01 -0800 • Engine revision 2994f7e1e6 • Dart version 2.7.0

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2) • Android SDK at /Users/iosdev/Library/Android/sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-29, build-tools 29.0.2 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 10.2.1) • Xcode at /applications/Xcode.app/Contents/Developer • Xcode 10.2.1, Build version 10E1001 • CocoaPods version 1.8.4

[✓] Android Studio (version 3.5) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 42.1.1 • Dart plugin version 191.8593 • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.41.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.7.1

[✓] Connected device (1 available) • iPhone Xʀ • E901CA1F-553F-41E6-864D-57E151B3F39F • ios • com.apple.CoreSimulator.SimRuntime.iOS-12-2 (simulator)

1
Have you tried a real phone number instead of 5555555 ? - Dimitri L.
Not yet, mainly as this is an iOS app, and I don't have an apple device to test it on yet. It's on my list of things to try though, thank you! - ArthurEKing
You don't need an apple device, just a valid phone number. The code is sent to the given phone number not vice versa. - Dimitri L.
True, never thought of that... Tried it and it's definitely not sending the text... So at least we know that. I'll have to verify if that's an issue with the firebase console I have set-up or something else. That's at least somewhere to look, although I'm not at all certain that it will solve the issue, I still thank you for the idea. - ArthurEKing
Update: After working at this for the last 3 days, managed to come away with an error code. 403 error. "Requests from this iOS client application <empty> are blocked." Meaning that the application is not recognizing the Bunle ID I have input, or not transmitting it to the servers. (for the record, I do have a BundeID and it is correct, first things I checked once I found this out, lol.) - ArthurEKing

1 Answers

0
votes

Well I found out the resolution to my issue. Apparently there's an issue with iOS that it refuses to treat the simulator like a real device, and so won't properly follow the flow of actual authentication using firebase.

So for anyone who has a similar issue, ensure you're doing your firebase_auth testing on an actual device.