Search code examples
javascriptfirebasefirebase-authenticationsign-in-with-google

Firebase Web authentication not working on mobile


I'm using signInWithPopup in firebase auth for web, after the user clicks the button he should authenticate and after he's done , a function runs, my code:

const loginWithGoogle = function(){
const user = auth.currentUser;
if(user){ // checking if user is already authenticated
addEverything();
}
else{
signInWithPopup(auth, provider).then(addEverything);
}
};

loginBtn.addEventListener('click',loginWithGoogle);

Okay this is perfect, it's working perfectly on my desktop and all other computers But not on mobile. when I click the button the authentication page loads but when I select the email and the authentication page disappears, NOTHING HAPPENS, really nothing happens, even the user email doesn't authenticate or show up in my firebase project, I also tried to connect my mobile to the desktop to check if there's anything in the console and guess what , nothing is there. But, if I enabled "Desktop Site" on mobile, everything works perfectly.


Solution

  • The problem is from firebase, the signInWithRedirect method doesn't work on all mobile phones