Skip to content

Latest commit

 

History

History
60 lines (47 loc) · 2.28 KB

File metadata and controls

60 lines (47 loc) · 2.28 KB

cordova-plugin-firebase-authentication
NPM version NPM downloads

Cordova plugin for Firebase Authentication

Installation

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.

Supported Platforms

  • iOS
  • Android

Methods

getIdToken(forceRefresh, callback, errorCallback)

Returns a JWT token used to identify the user to a Firebase service.

cordova.plugins.firebase.auth.getIdToken(function(idToken) {
    // send token to server
});

signInWithEmailAndPassword(email, password, callback, errorCallback)

Asynchronously signs in using an email and password.

cordova.plugins.firebase.auth.signInWithEmailAndPassword("my@mail.com", "pa55w0rd", function(userInfo) {
    // user is signed in
});

verifyPhoneNumber(phoneNumber, timeout, success, error)

Starts the phone number verification process for the given phone number.

cordova.plugins.firebase.auth.signInWithEmailAndPassword("+123456789", 10000, function(verificationId) {
    // pass verificationId to signInWithVerificationId
});

signInWithVerificationId(verificationId, smsCode, success, error)

Asynchronously signs in using verificationId and 6-digit SMS code.

cordova.plugins.firebase.auth.signInWithVerificationId("djgfioerjg34", "123456", function(userInfo) {
    // user is signed in
});

signOut(success, error)

Signs out the current user and clears it from the disk cache.

cordova.plugins.firebase.auth.signOut(function() {
    // user was signed out
});