<@U08614ZV82F> how to deal with unverified email d...
# permit-saas
g
@Ask Inkeep how to deal with unverified email during authentication
a
Thanks for tagging me @Graham. I'll look through relevant sources and get back to you shortly.
Based on the available documentation, Permit.io handles email verification status as part of the identity information that comes from your authentication provider. The identity models in Permit.io include an
email_verified
field that tracks whether an email address has been verified (1) (2) . This boolean field indicates whether the email address connected to an account identity is verified or not (1) . According to the documentation, for social providers like "Login with Google" this verification is done automatically, otherwise the system will send the user a verification link in email . When integrating with Permit.io, the email verification status is passed along with other identity information from your authentication provider (3) . After authentication completes, you can sync this information to Permit.io using
syncUser()
to ensure the authorization system has the most up-to-date user attributes . The Ruby SDK model shows this structure (1) :
Copy code
attr_accessor :email_verified
And the Go SDK similarly includes (2) :
Copy code
// GetEmailVerified returns the EmailVerified field value
func (o *IdentityRead) GetEmailVerified() bool {
	if o == nil {
		var ret bool
		return ret
	}

	return o.EmailVerified
}
To handle unverified emails in your authorization policies, you could include the email verification status as an attribute in your policy decisions, allowing you to restrict certain actions for users with unverified emails while still maintaining their authenticated session (3) .
g
@Ask Inkeep I use python
a
Thanks for tagging me @Graham. I'll look through relevant sources and get back to you shortly.
In Python, you can handle unverified emails during authentication with Permit.io by syncing the user's email verification status from your authentication provider (1) . After authentication, you should call
syncUser()
to update Permit.io with the latest user attributes . The email verification status comes from your authentication provider - for social providers like "Login with Google" this is done automatically, otherwise users receive a verification link via email (2) . For the Python SDK specifically, when approving invited users with unverified emails, you can use the following code (3) :
Copy code
await permit.api.users.approve(  
 user_key="new_user",  
 email="<mailto:new-user@example.com|new-user@example.com>",  
 invite_code="ed32bc43e2194a80a5ef5e0339943b44"  
)
The identity information includes an
email_verified
boolean field that tracks whether an email address has been verified (2) . You can pass this status as an attribute in
permit.check()
to dynamically include user details in access decisions (1) . This allows you to create policies that restrict certain actions for users with unverified emails while maintaining their authenticated session .
a
Hey @Graham (: Have you got your answer, or do you have any additional questions? We will be happy to help you.