For Web applications hosted on Firebase, I want to verify new users by emailing them a verification link. I went through the documentation, Create custom email action handlers, and configured my custom domain and have password authentication working fine.
So, how do I trigger a password verification? How do I get the oobCode and apiKey arguments? I'm registering a new user fine and nothing happens on my auth listener page?
var getArg = getArg();
var mode = getArg['mode'];
var oobCode = getArg['oobCode'];
var apiKey = getArg['apiKey'];
console.log(mode, oobCode, apiKey);
switch (mode) {
case 'resetPassword':
console.log('Password Request Fired');
break;
case 'recoverEmail':
console.log('Recover Email Fired');
break;
case 'verifyEmail':
console.log('Verify Email Fired');
break;
}
//Thanks Geoffrey Crofte
function getArg(param) {
var vars = {};
window.location.href.replace(location.hash, '').replace(
/[?&]+([^=&]+)=?([^&]*)?/gi, // regexp
function(m, key, value) { // callback
vars[key] = value !== undefined ? value : '';
}
);
if (param) {
return vars[param] ? vars[param] : null;
}
return vars;
}