in auth-next/custom-email-handler.js [6:56]
function handleUserManagementQueryParams() {
// TODO: This helpers should be implemented by the developer
function getParameterByName(name) {
return "";
}
// [START auth_handle_mgmt_query_params]
const { initializeApp } = require("firebase/app");
const { getAuth } = require("firebase/auth");
document.addEventListener('DOMContentLoaded', () => {
// TODO: Implement getParameterByName()
// Get the action to complete.
const mode = getParameterByName('mode');
// Get the one-time code from the query parameter.
const actionCode = getParameterByName('oobCode');
// (Optional) Get the continue URL from the query parameter if available.
const continueUrl = getParameterByName('continueUrl');
// (Optional) Get the language code if available.
const lang = getParameterByName('lang') || 'en';
// Configure the Firebase SDK.
// This is the minimum configuration required for the API to be used.
const config = {
'apiKey': "YOU_API_KEY" // Copy this key from the web initialization
// snippet found in the Firebase console.
};
const app = initializeApp(config);
const auth = getAuth(app);
// Handle the user management action.
switch (mode) {
case 'resetPassword':
// Display reset password handler and UI.
handleResetPassword(auth, actionCode, continueUrl, lang);
break;
case 'recoverEmail':
// Display email recovery handler and UI.
handleRecoverEmail(auth, actionCode, lang);
break;
case 'verifyEmail':
// Display email verification handler and UI.
handleVerifyEmail(auth, actionCode, continueUrl, lang);
break;
default:
// Error: invalid mode.
}
}, false);
// [END auth_handle_mgmt_query_params]
}