I am using python-social-auth
for letting user log in through fb, google and linkedin.
When a user is created by one of this backends and is stored in database.
We have the following: (Using django-mongodb-engine
not mongoengine
)
user_register_registration(Custom User model)
{
"_id": {
"$oid": "abcdxxxxxxx344"
},
"username": "something",
"utype": "AB",
"email": "abc@abc.com",
"last_login": {
"$date": "2014-12-10T07:12:41.848Z"
},
"password": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
and social_auth_usersocialauth
{
"_id": {
"$oid": "yxzxxxxxxx123"
},
"extra_data": "access token etc",
"user_id": {
"$oid": "abcdxxxxxxx344"
},
"uid": "abc@abc.com",
"provider": "google-oauth2"
}
django_session
{
"_id": "pqrxxxxxx543",
"expire_date": {
"$date": "2014-12-10T08:12:41.853Z"
},
"session_data": "session data"
}
How can i know which user was created using these backends.
Method I applied to solve this:
s = UserSocialAuth.objects.last()
ssid = s.user_id
OR
s = Registration.objects.last()
request.session['SSID'] = s.id
ssid = UserSocialAuth.objects.get(user_id=s.id)
This doesn't seem to the right way. I am concerned about concurrency problem and returning users.
This idea fails for returning users
Can we know session key or anything?