I'm following this tutorial to learn firebase. I cloned the repo. At step 7, I did what it said (though, actually, there was nothing to do here because the steps were already completed in the repo). When I click the [SIGN-IN WITH GOOGLE] button in the UI, the auth window pops open and closes immediately.
I'm developing in an Ubuntu Guest in VMWare. The following domains are authorized for this app in the firebase console:
The firebase website says ask here. I searched thouroughly first, the (few) other posted solutions didn't work.
Can anyone tell me why this is happening?
Sorry for late reply, and even though you decided to go further using another service provider the below might be helpful for others having the same issue.
The popup could be closed immediately after it opens due to an error which you can catch using step 5 from here: https://firebase.google.com/docs/auth/web/google-signin
Here is a brief snippet of how to do it, just modify signInWithPopup function in public/scripts/main.js:
firebase.auth().signInWithPopup(provider).then(function(result) {
// code which runs on success
}).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
console.log(errorCode);
alert(errorCode);
var errorMessage = error.message;
console.log(errorMessage);
alert(errorMessage);
});
To my experience the errorCode could be something like "auth/unauthorized-domain" and the errorMessage could point to the restricted domain you are accessing from: "This domain (127.0.0.1) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab."
The solution for me was to use localhost:8080 istead of 127.0.0.1:8080, however 127.0.0.1 also can be added to trusted domains using instructions in the errorMessage.
Your error might be different, but hope it helps to debug. Thanks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With