Enable Facebook sign-in OAuth with Firebase

Amir Movahedi
Red Gold
Published in
3 min readMay 2, 2018

Briefly, OAuth makes stuff simpler for users and also for developers to authorize users. Maybe it could be more reliable way too. Here we are going to learn how to use Facebook sign-in method in Firebase therefore user is able to sign-in apps with their Facebook account.

Step 1:

Go to Creating an App ID in Facebook Developer in Setting page of your Github account. Then choose Create new Facebook App.

Creating an App ID

In Create a New App ID input your app display name and you contact email. The click on Create App ID button.

Create new Facebook App

Then input Captcha in Security Check dialog, press Submit button.

Security Check

In your facebook app page choose Facebook Login Set Up.

In you app page choose Quickstart from Products menu. In Quickstart page choose Web (WWW).

Here you need to input your firebase host domain.

To get your site URL you need to go to Firebase console. In your project page choose Hosting from Develop menu. Copy domain from hosting page.

Firebase Hosting

Go back to Facebook developer page and paste your domain in Site URL field. Then press Save button.

Go back to Firebase Console. In your project page choose Authentication from Develop menu. Choose Facebook from Sign-in method tab. Select Enable to active facebook sign-in method. Copy OAuth redirect URI from last field.

Go back to Facebook Developer page. In Setting page from Products menu paste OAuth redirect URI in Valid OAuth Redirect URIs field. Then press Save button.

Step 2:

Go to Basic from Setting menu in Facebook Developers page. Then Copy App ID and App Secret (Click on Show button to see App Secret).

Facebook App Basic page

Go back to Firebase Console and paste App ID and App Secret in Facebook Sign-in method fields. Then press Save button.

Now your application is ready to use Facebook Sign-in Method.

For more information please checkout Firebase Facebook Authentication Document.

Hope it’s helpful!

--

--

Amir Movahedi
Red Gold

Full-Stack, Cloud, Kubernetes, IoT lover, distributed system and clean architecture. (every click is valuable!) https://amir.telar.dev