-
Notifications
You must be signed in to change notification settings - Fork 930
Can't signInWithPopup in chrome extension with manifest v3 #5588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I looked at the firebase-auth package and figure that if I specify to use the browserPopupRedirect, I will eventually call
which then uses
Note that I'm very far from being competent in javascript or chrome extensions, so I'm really grasping for straws here. |
Hi @klapauciusisgreat, thanks for reaching out. I don't have insight into Chrome's timelines/features/processes, but at a high level your initial judgement is correct. Popup sign in requires a DOM context and service workers don't provide that. As far as putting the log in in a different tab that the extension loads, I'm not sure the V3 CSP rules allow that:
In order for signInWithPopup to work, the SDK needs to load code from "apis.google.com", which in Manifest V2 required CSP rules that don't work under the new policy as I understand it. I've tried getting this to work locally and sure enough I'm unable to add "https://apis.google.com" to the CSP in V3 |
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
When trying to signin with Google (signInWithPopup) in a Chrome extension with manifest v3 (ie in a service worker), I trigger errors, popup does not open and one cannot log in.
Steps to reproduce:
The popup script (popup.js) calls the background script via message passing and asks for login.
The background script (background.js) initializes firebase and auth and calls
The specific error is in resolver.ts, line 38:
where
auth._popupRedirectResolver
isnull
.This is after replacing
with
Without that, I would get a known error about missing
window
when initializing auth.I suppose that this still has to do with service workers having not enough access to open a popup window. I would very much like to know if this is true, and specifically, if once manifest v2 is fully deprecated, there won't be any way to do signin with Google in chrome extensions anymore.
Relevant Code:
background.js
I realize that this maybe more of a Chrome Extension problem than a bug in firebase-auth, but my asks on crx and stackexchange have been met with stony silence. I suspect the real answer is that there is at present no way to make signInWithPopup work in MV3 at all(MV2 is working fine), and that the Crx team is not able to publicly state that Chrome extensions in the future will not have social signins (or 2FA signins). But I would very much like to know where I stand so I can plan accordingly.
Thank you very much in advance for clarifying!
The text was updated successfully, but these errors were encountered: