Skip to content

Instantly share code, notes, and snippets.

@origin1tech
Created October 8, 2015 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save origin1tech/73c8e01bbfb901f05fd0 to your computer and use it in GitHub Desktop.
Save origin1tech/73c8e01bbfb901f05fd0 to your computer and use it in GitHub Desktop.
Firebase OAuth Redirect
// Custom connection class to obtain root conneciton.
var conn = new FirebaseConnection('auchat');
// conn returns the connection class instance
// of which contains a property called "root"
// which is the Firebase root ref.
conn.root.onAuth(function(authData) {
if (authData !== null) {
console.log("Authenticated successfully with payload:", authData);
} else {
// Try to authenticate with Google via OAuth redirection
conn.root.authWithOAuthRedirect("github", function(error, authData) {
if (error) {
console.log("Login Failed!", error);
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment