thisbejim / Pyrebase

A simple python wrapper for the Firebase API.
2.05k stars 525 forks source link

How do Ik if the user has verified his email and then only signIn the user? #372

Open bhaveshsingh0206 opened 3 years ago

bhaveshsingh0206 commented 3 years ago

Make sure these boxes are checked before submitting your issue:

[] Check that your version of Python is 3.4+ [] Check that you are on the newest version of Pyrebase [] Check that Email/password provider is enabled in your Firebase dashboard under Auth -> Sign In Method.

Please don't be discouraged if you do not get a response to your issue quickly, I maintain Pyrebase for fun and don't always have as much free time as I'd like.

Thank you for helping make Pyrebase better!

Maneesh-Pradeep commented 3 years ago

Hey @bhaveshsingh0206 , sorry for this late reply. You can check whether the user has verified his mail or not by checking the emailVerified key in auth.get_account_info() once they login or create their account. Example:

user = auth.sign_in_with_email_and_password('example@mail.com', 'Password')
id = auth.get_account_info(user['idToken'])
emailVerified = id['users'][0]['emailVerified']

The emailVerified is a boolean value (True or False). You can use this to make sure that your users verify their mail.