Facebook authentication with Firebase

Posted By : Ankit Sharma | 30-Sep-2015

To integrate facebook authentication in your firebase application, you need to first creat a new facebook application.

Go to https://developers.facebook.com/apps  and login with your credentials and click on Add a new App.

 

ClickAdd.PNG

 

Next you need to create a new app id

CreateApp.PNG

Provide display name and choose your app category and click create.

Next, lookup for App ID and App secret.

AppId.PNG

 

Now click on setting on left panel and then advance on top panel and then  put this  

https://auth.firebase.com/v2/myApp/auth/facebook/callback in  Valid OAuth redirect URIs textbox, replace myApp with your app name. Validurl.PNG

click save changes.

saveChnages.PNG

 

So, we have successfully created a facebook application.

Now, click on Manage App button of you firebase application.

 

manageApp.PNG

 

Now select login and auth tab from left panel and then select Facebook as the authentication provider. Fill your facebook App ID and App Seceret here.

selectfb.PNG

 

You are all set with the configuration, now it’s time to code.

If your user don’t have an existing session than you can prompt your user to login and then invoke the facebook login popup with the following snippet

var ref = new Firebase("https://firebaseloginApp.firebaseio.com");
ref.authWithOAuthPopup("facebook", function(error, authData) {
if (error) {
console.log("Login Failed!", error);
} else {
console.log("Authenticated successfully", authData);
}
});

 


THANKS
 

About Author

Author Image
Ankit Sharma

Ankit is a Technical Project Manager with expertise in Java, Spring Framework, Artificial Intelligence, Machine Learning, and Team Management. In his free time, he likes to read books and listen to music.

Request for Proposal

Name is required

Comment is required

Sending message..
Yono Rummy YonoRummy Rummy Codes Rummy Promo Codes Rummy Yono App Yono Rummy APK Game Yono Rummy Yono Rummy Games sarkari naukri dunia TOTOSGP TOTO SGP TOTOSGP TOTO SGP TOTOSGP TOTOSGP India Games Online Platform Popular Games in India India Gaming Experience Online Games India Best Rummy Games in India India Games Collection Teen Patti Games India Rummy Games Online India India Rummy Gaming Platform Popular Rummy Platform India Online Rummy Games India India Mobile Gaming India Gaming Platform Indian Online Games India Games and Entertainment India Gaming Community India Online Gaming Platform Teen Patti Online Games India Rummy and Teen Patti Games