Last active
November 16, 2021 15:41
-
-
Save flakerimi/ebb798e912902d0d85deb55e154e22d3 to your computer and use it in GitHub Desktop.
Login
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Login extends StatelessWidget { | |
final _phoneController = TextEditingController(); | |
void verifyPhone(_phoneController) async { | |
FirebaseAuth _auth = FirebaseAuth.instance; | |
_auth.verifyPhoneNumber( | |
phoneNumber: _phoneController.text, | |
timeout: const Duration(seconds: 60), | |
verificationCompleted: (PhoneAuthCredential credential) async { | |
// ANDROID ONLY! | |
// Sign the user in (or link) with the auto-generated credential | |
await auth.signInWithCredential(credential); | |
}, | |
verificationFailed: (FirebaseAuthException exception) {}, | |
codeSent: (String verificationId, int? resendToken) async { | |
// Update the UI - wait for the user to enter the SMS code | |
verifyCode(verificationId, smsController); | |
// Create a PhoneAuthCredential with the code | |
}, | |
codeAutoRetrievalTimeout: (String verificationId) {}); | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment