Adding Cordova Plugins

Last Updated: 06/12/2020


NOTE: This "Legacy" section is old and is now meant for Advanced Developers who want to export using the Cordova CLI.
For most users, "Firebase Auth Pro Mobile" Plugin is recommended.


OAuth Providers

  1. If you are using OAuth Providers for your project, run the following commands:

cordova plugin add cordova-plugin-buildinfo --save

cordova plugin add cordova-universal-links-plugin-fix --save

cordova plugin add cordova-plugin-browsertab --save

cordova plugin add cordova-plugin-inappbrowser --save

(You will get this error at 'cordova-plugin-compat'. Ignore it.)


2. In the Firebase Console, go to Dynamic Links and click on get started. Now add a Dynamic Link Domain like example.page.link


<universal-links>

<host name="DYNAMIC_LINK_DOMAIN" scheme="https" />

<host name="AUTH_DOMAIN" scheme="https">

<path url="/__/auth/callback"/>

</host>

</universal-links>

3. Note the above code. Here, replace DYNAMIC_LINK_DOMAIN with the domain you just added. Also replace AUTH_DOMAIN with authDomain in your Firebase Console > Project Settings > SDK snippet.


4. Copy that code, open config.xml file in your Cordova project folder and find </widget>. Paste that code just before this word.


5. Go to YOUR_CORDOVA_APP_LOCATION\plugins\cordova-universal-links-plugin\hooks\lib\android, open manifestWriter.js


6. Replace the highlighted line with this:

var pathToManifest = path.join(cordovaContext.opts.projectRoot, 'platforms', 'android', 'app', 'src', 'main', 'AndroidManifest.xml');


Phone Auth-Cordova

  1. If you are using Phone Auth for your project, run the following commands:

cordova plugin add cordova-plugin-firebase-authentication@3.6.0

cordova plugin add cordova-plugin-inappbrowser


  1. If you have installed plugins for OAuth as well, run this command:

cordova plugin add cordova-plugin-androidx-adapter


  1. Add an Android app to your Firebase Project from the Console. Go to Console Settings, and Download google-services.json

4. Paste the google-services.json file at YOUR_CORDOVA_APP_LOCATION\platforms\android\app


5. Go to Firebase Console > Settings, and add SHA certificate fingerprints to your Android app project.

NOTE- See #Building .APK to know how to get your SHA certificate fingerprints.