I have a Python/Flask app running on Google App Engine and I use Firebase Auth with FirebaseUI. I’ve had Google sign-in providers working for some time but I’m now adding email link based sign-ins. I’m able to successfully get the email, but clicking the sign-in link results in an error message on the page:
The requested action is invalid.
The JS console contains another error:
handler.js:220 Request is missing required data
I can’t find anything in the logs relating to this error, and I’ve quadruple checked all the relevant settings in Firebase Console such as authenticated domains, API key permissions, etc.
Here’s my Javascript for invoking FirebaseUI:
var uiConfig = {
callbacks: {
signInSuccessWithAuthResult: () => false,
},
signInOptions: [
{
provider: firebase.auth.EmailAuthProvider.PROVIDER_ID,
signInMethod: firebase.auth.EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD,
forceSameDevice: false,
emailLinkSignIn: function () {
return {
url: window.location.href,
// Always true for email link sign-in, according to the docs.
handleCodeInApp: true,
};
},
},
{
provider: firebase.auth.GoogleAuthProvider.PROVIDER_ID,
customParameters: {
prompt: "select_account",
},
},
],
signInFlow: "popup",
signInSuccessUrl: redirect_url,
tosUrl: "https://example.com/terms",
privacyPolicyUrl: "https://example.com/terms",
};
var ui = new firebaseui.auth.AuthUI(firebase.auth());
ui.start("#firebaseui-auth-container", uiConfig);
Here’s my Firebase config used:
{
'apiKey': 'API-KEY-HERE',
'authDomain': 'auth.example.com',
'projectId': 'MYPROJECT2',
'appId': 'APP-ID'
}
The email I receive contains a link that looks like this (note that auth.example.com is maintained by Firebase):
https://auth.example.com/__/auth/handler?apiKey=API-KEY&mode=signIn&oobCode=C49X_zEgdOj_cFl3sLh784gnEg-808Q06e7L80VeFPUAAAGXkK4k6Q&continueUrl=https://dev-dot-MYPROJECT2.appspot.com/signin&lang=en
I can’t figure out what’s going on, and even the Gemini AI in the Firebase Console has been no help. Anyone have any ideas what I’m missing here?