CodexBloom - Programming Q&A Platform

Facebook Login: Redirect URI optimization guide with React and Firebase Auth

πŸ‘€ Views: 0 πŸ’¬ Answers: 1 πŸ“… Created: 2025-06-17
firebase facebook react JavaScript

I've been working on this all day and I've been working on this all day and I'm currently working with an scenario with the Facebook login integration in my React app using Firebase Authentication. After setting it up according to the Firebase documentation, the login process initiates correctly, but when the authentication is complete, the redirect URI doesn't seem to work as expected. I configured my Facebook app to include the correct OAuth redirect URI, which I made sure matches the one in my Firebase console. However, when I attempt to log in, I'm greeted with the following behavior message: ``` behavior: Redirect URI mismatch. The redirect URI must match the URL registered in the app's settings. ``` Here's the code snippet I am using for the Facebook login: ```javascript import firebase from 'firebase/app'; import 'firebase/auth'; const provider = new firebase.auth.FacebookAuthProvider(); function signInWithFacebook() { firebase.auth().signInWithPopup(provider) .then((result) => { // This gives you a Facebook Access Token. You can use it to access the Facebook API. const token = result.credential.accessToken; const user = result.user; console.log(user); }) .catch((behavior) => { console.behavior('behavior during login: ', behavior); }); } ``` I’ve double-checked my app settings on the Facebook Developer dashboard and ensured that the redirect URI is correct. It’s set to `https://myapp.firebaseapp.com/__/auth/handler`. Also, I’m running my app on `http://localhost:3000` for development purposes. Is there something I might be missing here? Any insights on why the redirect URI could be causing an scenario would be greatly appreciated. I've also verified that my Firebase SDK version is the latest (9.6.1). Any help would be appreciated! I'm developing on Windows 10 with Javascript. Could this be a known issue? The project is a REST API built with Javascript. What's the best practice here?