firebase / quickstart-js

Firebase Quickstart Samples for Web
https://firebase.google.com
Apache License 2.0
5.1k stars 3.66k forks source link

signInWithPopup - Chrome Extension Not Working #286

Open zzpreneur opened 5 years ago

zzpreneur commented 5 years ago

I've followed the instructions here. I'm using auth.signInWithPopup() to connect with a provider. It's properly set up and running in background.js. I'm getting this error when triggering the login:

"This domain (site) 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."

I add it. The error is gone, the popup displays, but it's blank. It gives no error. Any ideas? Anyone else able to authenticate via chrome extension using a provider?

michaelwang11394 commented 4 years ago

Hi @zzpreneur, did you ever figure out a solution to this? Thanks!

zzpreneur commented 4 years ago

@michaelwang11394 I did not. Ended up using the email/password auth.

penge commented 4 years ago

Hi @zzpreneur

Here's how to solve it.

1) Open https://console.firebase.google.com 2) Go to Authentication / Sign-in method / Authorized domains, click on Add Domain 3) Add your Chrome extension address, like this:

image

image

After this, reload the extension in chrome://extensions and all should be working 🙂👍

Screen Shot 2020-07-26 at 6 10 47 AM
klapauciusisgreat commented 2 years ago

I, too, got this working in Manifest v2. Penge's suggestion seems exactly right.

However, I have found no way to make signInWithPopup work in Manifest V3, because of the security restrictions of service workers. I'm still trying mad things like rewriting the library to open a new window it might have access to, but so far no luck.

Could someone from the firebase team speak to what the plan is ?

1) have a clever implementation ready in time for the deprecation of manifest v2 in January 2022 ? 2) get some extra time from Chrome team to come up with a better solution (either in firebase or the chrome extension model?) 3) Know for sure that when v2 gets sunset, there will be no way anymore to signInWithPopup (or any other auth model requiring a window?)

I imagine having an approximate answer would save a lot of people a lot of time and worry.

Many thanks to whoever can help!

hodovani commented 2 years ago

@klapauciusisgreat I am looking for the solution, too.