Created
October 8, 2015 20:33
-
-
Save origin1tech/73c8e01bbfb901f05fd0 to your computer and use it in GitHub Desktop.
Firebase OAuth Redirect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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