Skip to content

Instantly share code, notes, and snippets.

@katowulf
Created June 30, 2016 22:07
Show Gist options
  • Save katowulf/de9ef6b04552091864fb807092764224 to your computer and use it in GitHub Desktop.
Save katowulf/de9ef6b04552091864fb807092764224 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