Cordova plugin for Firebase Authentication
cordova plugin add cordova-plugin-firebase-authentication --save
To use phone number authentication on iOS, your app must be able to receive silent APNs notifications from Firebase. For iOS 8.0 and above silent notifications do not require explicit user consent and is therefore unaffected by a user declining to receive APNs notifications in the app. Thus, the app does not need to request user permission to receive push notifications when implementing Firebase phone number auth.
- iOS
- Android
Returns a JWT token used to identify the user to a Firebase service.
cordova.plugins.firebase.auth.getIdToken(function(idToken) {
// send token to server
});
Asynchronously signs in using an email and password.
cordova.plugins.firebase.auth.signInWithEmailAndPassword("my@mail.com", "pa55w0rd", function(userInfo) {
// user is signed in
});
Starts the phone number verification process for the given phone number.
cordova.plugins.firebase.auth.signInWithEmailAndPassword("+123456789", 10000, function(verificationId) {
// pass verificationId to signInWithVerificationId
});
Asynchronously signs in using verificationId and 6-digit SMS code.
cordova.plugins.firebase.auth.signInWithVerificationId("djgfioerjg34", "123456", function(userInfo) {
// user is signed in
});
Signs out the current user and clears it from the disk cache.
cordova.plugins.firebase.auth.signOut(function() {
// user was signed out
});