#How to set email_verified when user goes through Email Stage?

1 messages · Page 1 of 1 (latest)

glacial geyser
#

The Property Scope Mapping: authentik default OAuth Mapping: OpenID 'email' returns "email_verified" hardcoded as False.

return {
    "email": request.user.email,
    "email_verified": False
}

Some solutions suggest to manually create a new mapping where we set the property to true and use that custom scope mapping instead, but I would like to have an automated way of users verifying themselves.

When creating a Stage there is a template for "Email Stage" (first screenshot).
How can I have it so that when a user passes the Email Stage, that that user has "email_verified" set to true?

One could say "just leave email_verified to true, they need to pass the email stage anyway". But what if a user is changing their email?
How would I solve this problem?

brazen grail
#

first part would be to have an attribute in the users called email_verified and in the openid mapping returning the value of that attribute:

"email_verified": request.user.attributes.get("email_verified", "False"),

with a fallback to "False" if the attribute could not be found

now you only need a way to set it to true on a user that used an actual verification. In the beginning of the linked thread someone wrote something about that. read up on that. i hope its something helpful in it