i'm doing a user authentication system in Reactjs with firebase with google signin method, as I think my code does not have any problem, but when I click in the button the Popup shows and close immediatly and the error in my console is:
FirebaseError: Firebase: Error (auth/unauthorized-domain).
I went to firebase console > Authentication > Sign-In-Method to authorize domain, and can't see where I can put my domain
Sorry my English it's not my first language
my code, I'm using vite to create react project
// Import the functions you need from the SDKs you need
import { initializeApp } from "firebase/app";
import { getAuth, signInWithPopup, GoogleAuthProvider } from "firebase/auth";
// Your web app's Firebase configuration
const firebaseConfig = {
apiKey: "AIzaSyBPbVyiVcN4K7cmMSo1QsPJQeIxZUZ7yCE",
authDomain: "social-app-bc20f.firebaseapp.com",
projectId: "social-app-bc20f",
storageBucket: "social-app-bc20f.appspot.com",
messagingSenderId: "426481165558",
appId: "1:426481165558:web:07720e6132e0d91c21b8d7"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const provider = new GoogleAuthProvider();
export const auth = getAuth();
export const signInWithGoogle = () => {
signInWithPopup(auth, provider)
.then((result) => {
// ...
console.log(result)
}).catch((error) => {
// Handle Errors here.
console.log(error)
});
}
CodePudding user response:
firebase console > Authentication > Settings to authorize domain