Socket
Socket
Sign inDemoInstall

cordova-plugin-firebase

Package Overview
Dependencies
0
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.24 to 0.1.25

src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIRAnalyticsSwiftNameSupport.h

5

package.json

@@ -11,3 +11,3 @@ {

"name": "cordova-plugin-firebase",
"version": "0.1.24",
"version": "0.1.25",
"description": "Cordova plugin for Google Firebase",

@@ -29,4 +29,5 @@ "cordova": {

"push",
"notifications"
"notifications",
"phone auth"
]
}

100

README.md

@@ -11,2 +11,31 @@ # cordova-plugin-firebase

## in this fork
### verifyPhoneNumber (Android only)
Request a verificationId and send a SMS with a verificatioCode.
Use them to construct a credenial to sign in the user (in your app).
https://firebase.google.com/docs/auth/android/phone-auth
https://firebase.google.com/docs/reference/js/firebase.auth.Auth#signInWithCredential
NOTE: To use this auth you need to configure your app SHA hash in the android app configuration on firebase console.
See https://developers.google.com/android/guides/client-auth to know how to get SHA app hash.
NOTE: This will only works on physical devices.
```
window.FirebasePlugin.verifyPhoneNumber(number, timeOutDuration, function(credential) {
console.log(credential);
// ask user to input verificationCode:
var code = inputField.value.toString();
var verificationId = credential.verificationId;
var signInCredential = firebase.auth.PhoneAuthProvider.credential(verificationId, code);
firebase.auth().signInWithCredential(signInCredential);
}, function(error) {
console.error(error);
});
```
## Installation

@@ -17,7 +46,7 @@ See npm package for versions - https://www.npmjs.com/package/cordova-plugin-firebase

```
<plugin name="cordova-plugin-firebase" spec="0.1.24" />
<plugin name="cordova-plugin-firebase" spec="0.1.25" />
```
or by running:
```
cordova plugin add cordova-plugin-firebase@0.1.24 --save
cordova plugin add cordova-plugin-firebase@0.1.25 --save
```

@@ -43,2 +72,13 @@ Download your Firebase configuration files, GoogleService-Info.plist for ios and google-services.json for android, and place them in the root folder of your cordova project:

## Google Tag Manager
### Android
Download your container-config json file from Tag Manager and add a resource-file node in your config.xml.
```
....
<platform name="android">
<content src="index.html" />
<resource-file src="GTM-5MFXXXX.json" target="assets/containers/GTM-5MFXXXX.json" />
...
```
## Changing Notification Icon

@@ -240,5 +280,13 @@ The plugin will use notification_icon from drawable resources if it exists, otherwise the default app icon will is used.

```
window.FirebasePlugin.fetch();
window.FirebasePlugin.fetch(function () {
// success callback
}, function () {
// error callback
});
// or, specify the cacheExpirationSeconds
window.FirebasePlugin.fetch(600);
window.FirebasePlugin.fetch(600, function () {
// success callback
}, function () {
// error callback
});
```

@@ -347,1 +395,45 @@

```
### Phone Authentication
**BASED ON THE CONTRIBUTIONS OF**
IOS
https://github.com/silverio/cordova-plugin-firebase
ANDROID
https://github.com/apptum/cordova-plugin-firebase
**((((IOS))): SETUP YOUR PUSH NOTIFICATIONS FIRST, AND VERIFY THAT THEY ARE ARRIVING TO YOUR PHYSICAL DEVICE BEFORE YOU TEST THIS METHOD. USE THE APNS AUTH KEY TO GENERATE THE .P8 FILE AND UPLOAD IT TO FIREBASE.
WHEN YOU CALL THIS METHOD, FCM SENDS A SILENT PUSH TO THE DEVICE TO VERIFY IT.**
This method sends an SMS to the user with the SMS_code and gets the verification id you need to continue the sign in process, with the Firebase JS SDK.
```
window.FirebasePlugin.getVerificationID("+573123456789",function(id) {
console.log("verificationID: "+id);
}, function(error) {
console.error(error);
});
```
Using Ionic2?
```
(<any>window).FirebasePlugin.getVerificationID("+573123456789", id => {
console.log("verificationID: " + id);
this.verificationId = id;
}, error => {
console.log("error: " + error);
});
```
Get the intermediate AuthCredential object
```
var credential = firebase.auth.PhoneAuthProvider.credential(verificationId, SMS_code);
```
Then, you can sign in the user with the credential:
```
firebase.auth().signInWithCredential(credential);
```
Or link to an account
```
firebase.auth().currentUser.linkWithCredential(credential)
```

@@ -55,9 +55,2 @@ #!/usr/bin/env node

// Copy key files to their platform specific folders
if (directoryExists(IOS_DIR)) {
copyKey(PLATFORM.IOS);
} else if (directoryExists(ANDROID_DIR)) {
copyKey(PLATFORM.ANDROID, updateStringsXml)
}
function updateStringsXml(contents) {

@@ -136,1 +129,15 @@ var json = JSON.parse(contents);

}
module.exports = function(context) {
//get platform from the context supplied by cordova
var platforms = context.opts.platforms;
// Copy key files to their platform specific folders
if (platforms.indexOf('ios') !== -1 && directoryExists(IOS_DIR)) {
console.log('Preparing Firebase on iOS');
copyKey(PLATFORM.IOS);
}
if (platforms.indexOf('android') !== -1 && directoryExists(ANDROID_DIR)) {
console.log('Preparing Firebase on Android');
copyKey(PLATFORM.ANDROID, updateStringsXml)
}
};

@@ -0,1 +1,7 @@

exports.getVerificationID = function(number, success, error) {
if (typeof success === 'function') {
success();
}
};
exports.getInstanceId = function(success, error) {

@@ -120,1 +126,7 @@ if (typeof success === 'function') {

};
exports.verifyPhoneNumber = function(number, timeOutDuration, success, error) {
if (typeof success === 'function') {
success();
}
};
var exec = require('cordova/exec');
exports.getVerificationID = function(number, success, error) {
exec(success, error, "FirebasePlugin", "getVerificationID", [number]);
};

@@ -122,1 +125,5 @@ exports.getInstanceId = function(success, error) {

};
exports.verifyPhoneNumber = function(number, timeOutDuration, success, error) {
exec(success, error, "FirebasePlugin", "verifyPhoneNumber", [number, timeOutDuration]);
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc