Open burtonator opened 4 years ago
Looking through this now the main issue is that a number of things assume chrome extension not extensions for other platforms/browsers.
For example:
/**
* @private @const {string} The Chrome extension invalid origin message
* template.
*/
fireauth.InvalidOriginError.CHROME_EXTENSION_MESSAGE_TEMPLATE_ = 'This chrom' +
'e extension ID (chrome-extension://%s) is not authorized to run this op' +
'eration. Add it to the OAuth redirect domains list in the Firebase cons' +
'ole -> Auth section -> Sign in method tab.';
... I'm not sure it makes sense to create a error for all of them so we might need to pass the extension scheme.
I have a branch here:
https://github.com/polar-app/firebase-js-sdk
but I think it will require a bit more work as there needs to be a generic method to work with extension types. I'm sure Safari and MS Edge have different extension schemes and those should be supported too.
Hey there! I've filed b/172259549 to track this feature request internally :)
Hello, are there any updates on if or when this will be addressed?
This is a big issue too as it's anti-competitive for Google to block other browsers (whether inadvertent or not).
Changing this SDK alone is not enough to allow moz-extension to work as the Authorized domains list in Firebase Console prevents the addition of moz-extension:// domains.
Anyone know of a workaround that allows auth to work in Firefox extensions?
For Google auth I ended up using browser.identity.launchWebAuthFlow
(to https://accounts.google.com/o/oauth2/v2/auth with the client ID used by Firebase), parsing the id token in the result and calling the following:
const credential = firebase.auth.GoogleAuthProvider.credential(idToken);
const userCredentials = await firebase.auth().signInWithCredential(credential);
Hi! I'm on the Firebase team. This would be a welcomed community contribution. Feel free to open your PR as a work in progress if you'd like feedback.
Hi @rachelmyers, as mentioned earlier, even if the SDK were to allow moz-extension, it would not work as the following page in the Firebase console does not allow moz-extension:// to be input.
@nopol10 do you find a solution?
For Google auth I ended up using
browser.identity.launchWebAuthFlow
(to https://accounts.google.com/o/oauth2/v2/auth with the client ID used by Firebase), parsing the id token in the result and calling the following:const credential = firebase.auth.GoogleAuthProvider.credential(idToken); const userCredentials = await firebase.auth().signInWithCredential(credential);
@Pierre-CLIND this was what I used to overcome the issue. A more complete implementation can be found here: https://github.com/nopol10/nekocap/blob/1c5dff15b11e7bc4bce206a42437e68b33150f6c/src/common/providers/parse/parse-provider.tsx#L80
@nopol10 I still get the auth/unauthorized-domain
and auth/operation-not-supported-in-this-environment
errors following the logic in your code. When I try to add the mozilla extension, I get the validation error you mentioned. Is there something I am missing?
[REQUIRED] Describe your environment
Firefox extensions use the scheme moz-extension but Firebase auth only works with chrome-extension.
Maybe there needs to be a web-extension URI scheme?
Anyway. Firebase auth needs to support this as our chrome extension works fine but won't work in Firebase.
This should be a super simple fix and I can just submit a PR.
Steps to reproduce:
Relevant Code:
https://stackblitz.com/fork/firebase-issue-sandbox