omab/python-social-auth

association by email using Facebook, Google oAuth2 and default backend

gh67uyyghj opened this issue · 2 comments

Hi @omab and thanks to everyone who contributed building this important piece of software, this is a question and not a bug report so I hope for an answer before closing this issue.

I need to associate by email the same account for Facebook, Google (oAuth2) and the default username/password django backend. I inspected the source code for associate_by_email() in the pipeline and I understood that I should check if the backend email is verified. How can I do that? in Facebook there is one entry called verified in public_profile permission. How can I extract this field from the auth response since the default associate_by_email() doesn't do it? is there in google also a verified field also in any scope? (I know this may sound too stupid since google itself is the email provider but frankly I am not sure and that's why I am asking)

omab commented

Hi @eronaeon, Facebook and Google can be consideres as having email verified, I assume it's a @gmail.com address or google-app address (since you are using Google), and the same address is in Facebook, for google is already "validated", since it's the source of the address, and Facebook validates the email addresses as part of the signup process.

Thanks so much @omab! so this means that using the default associate_by_email() for these three backends: Facebook oauth2, Google oauth2 and default django backend (assuming the email of the default django backend is verified) is sufficient, am I right?

Additionally, to make sure (maybe this may be helpful to noobs like me), I signed up a new account to Facebook using some random email, I tried to login to my app using Facebook oauth2 with this newly registered & unverified Facebook account, Facebook asked me to verify the email first in order to authorize the app.