Skip to content

Instantly share code, notes, and snippets.

@EloneSampaio
Forked from katowulf/auth.js
Created August 19, 2016 00:42
Show Gist options
  • Save EloneSampaio/1fc368427a440de25047bd7a6fb63365 to your computer and use it in GitHub Desktop.
Save EloneSampaio/1fc368427a440de25047bd7a6fb63365 to your computer and use it in GitHub Desktop.
Auth with Firebase 3.x and Cordova/Ionic using ngCordova oauth.
this.$cordovaOauth.facebook("your_client_id", ["email"])
.then(function (result) {
var credentials = firebase.auth.FacebookAuthProvider.credential(result.access_token);
return firebase.auth().signInWithCredential(credentials);
})
.then(function (firebaseUser) {
console.log("Signed in as:", firebaseUser.uid);
})
.catch(function (error) {
console.error("Authentication failed:", error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment