14

I'm using Google's OpenID Connect service to authenticate users. I was considering rejecting all accounts if the email_verified field was false, but I don't see a real world scenario where someone will hit my system with this field set to false.

The first time you log in to Google the user's account becomes verified, so won't they always be verified from the perspective of my 3rd party app?

William Denniss
  • 16,089
  • 7
  • 81
  • 124
jekennedy
  • 1,192
  • 10
  • 17
  • might be useful for someone. this link has all the details https://jpassing.com/2021/01/27/what-does-the-email_verified-claim-indicate-in-google-idtokens/ – Arun Aug 06 '22 at 19:12

1 Answers1

19

If you get an ID Token from Google, the user's email will always be verified, and this value will be true.

In the rare case where the user had yet to verify their account's email address and attempts to use OpenID Connect, they will see an error message informing them that they need to verify their account, with steps on how to complete that. This is the current behavior for Google's OpenID Connect implementation at least.

If you are relying on verified email addresses, then out of correctness you probably should reject logins that don't have email_verified=true, but the good news is that your system shouldn't ever see that case from Google.

Not exactly sure how you're using the email, but typically authentication systems use the sub and iss ID Token claims to uniquely identify the user & IdP, rather than relying on the email address which is subject to change.

William Denniss
  • 16,089
  • 7
  • 81
  • 124
  • 2
    I know it's old but can you link me to a document where it is mentioned? – Kishan Vaishnav Feb 26 '20 at 06:02
  • 1
    @KishanVaishnav the document is here: https://developers.google.com/identity/protocols/oauth2/openid-connect – evedovelli Sep 01 '21 at 01:37
  • When`email_verified` is `true` can I assume that the Google user is not impersonating someone else's email address? Is it safe to connect this account to the same, existing email address in my app? – Florian Walther Aug 20 '22 at 08:43