Suddenly not getting user verification email from Firebase for my sign up

Hi there,
I first had a login page with the signup on it, and had it working, but I thought it was confusing for the user, so I created a separate Sign Up page.

I got my Sign Up page to work, AND my Log In page, and even got it so that after someone signs up they’re immediately redirected to the login page with a message that they’ll receive an email and they can log in now. I got it working!

But…I am not getting the verification emails from Firebase as a new user even though the accounts are being created and I can log in after I create the account. I know only some of you use Firebase but I’m hoping you might know why, or how to fix it so that someone signing up gets the emails?

Thank you,
Cheryl

1 Like

Er–I solved it. I had one of the brackets wrong in the formula. I’m getting the email verifications now!

BUT I can log into my app immediately after creating an account, without verifying the email for Firebase. I’m guessing that that shouldn’t happen, but I don’t know how to fix that. If anyone has a suggestion that would be lovely!

Hi!

After a bit of googling I understood that the user object in firebase authentication has the property emailVerified , which is true/false. This could be checked when the user tries to log in: if emailVerified == true then let them through, if it’s false then don’t let them log in :slight_smile: Here’s the pages I found: 1 & 2, let me know if this example is not your use case.


I’d also like to allow users in only if their emails are verified, right now I can only sign users in/up. Am I doing something wrong? I’m fetching the user data to see if “emailVerified” is true or false using http request (I use the toast to check the response payload) and it’s working but the if condition doesn’t work

Hmm the logic seems fine! So you are able to see in the toast that the "emailVerified" is true? For the dismiss initial view to work you have to enable authentication, configured and initial view for your app, and are using it in the initial view page.

You could add also toasts to the outputs of the IF node to see if it always come out as false, or whether the IF is fine but there’s something wrong with Dismiss initial view. Also, that formula should work fine but you can also try LOOKUP(outputs["get user data"].resBody, "emailVerified") in case that makes any difference.

Hi thank you for your suggestion!
Yepp I have authentication on with my initial page being this login page. so I’ve tried what you suggested and connected the IF LOOKUP(outputs[“getUserData”].resBody, “emailVerified”) to a toast, for the true output I get blank and for its false output I get {}.

I also tried another way by binding page variable emailVerified (its initial value is false) to the output outputs[“getUserData”].resBody[“emailVerified”] then using IF pageVars.emailVerified == true, connected that to toast, the true output I get is blank, false output is {}

When I link dismiss initial view to the IF false output from both methods , dismiss initial view works but not when connected to IF true output. And works regardless if the actual value of “emailVerified” is actually true or false (I checked by logging in as a different user accounts with email verified and email not verified)

Perhaps I’m not capturing “emailVerified” within the JSON output from getUserData in some way?
I looked at the raw JSON output using Postman and I realise emailVerified under user in an array??
here it is:
{
“kind”: “identitytoolkit#GetAccountInfoResponse”,
“users”: [
{
“localId”: “SlsP0rDpIqXGSeu2m9nf6fAanvd2”,
“email”: “pavac92364@netjook.com”,
“passwordHash”: “UkVEQUNURUQ=”,
“emailVerified”: true,
“passwordUpdatedAt”: 1615211078320,
“providerUserInfo”: [
{
“providerId”: “password”,
“federatedId”: “pavac92364@netjook.com”,
“email”: “pavac92364@netjook.com”,
“rawId”: “pavac92364@netjook.com
}
],
“validSince”: “1615211078”,
“lastLoginAt”: “1615375124687”,
“createdAt”: “1615211078320”,
“lastRefreshAt”: “2021-03-10T11:18:44.687Z”
}
]
}

so I changed up the if condition again

connected it to toast and its true output is blank and false output is {}

Alright, sounds like you’re not getting to the emailVerified as you said. I think the correct way to get to emailVerified in this case would be:

outputs[“getUserData”].resBody.users[0].emailVerified

PICK_ITEM tries to get the fourth object within the users list, but in the response you provided there’s only one object within users. Instead, we get to that one object with the index 0 , and then pick the emailVerified within that :slight_smile:

1 Like

thank you Cecilia it works :smiley:
mwhahaha, I’m pretty chuffed.

1 Like