Comments (21)
Add these entries to the top of you pipeline setting:
'social.pipeline.social_auth.social_details',
'social.pipeline.social_auth.social_uid',
'social.pipeline.social_auth.auth_allowed',
So, it should look like:
SOCIAL_AUTH_PIPELINE = (
'social.pipeline.social_auth.social_details',
'social.pipeline.social_auth.social_uid',
'social.pipeline.social_auth.auth_allowed',
'social.pipeline.social_auth.social_user',
'social.pipeline.social_auth.associate_by_email',
'social.pipeline.user.get_username',
'social.pipeline.user.create_user',
'social.pipeline.social_auth.associate_user',
'social.pipeline.social_auth.load_extra_data',
'social.pipeline.user.user_details',
'accounts.social_auth_pipeline.get_profile_data', # custom
'accounts.social_auth_pipeline.get_profile_avatar', # custom
)
from python-social-auth.
Thanks for response.
I've tried adding those settings to the pipeline setting. In do_complete i have AnonymousUser as user after strategy.session_get but in authenticate method of strategy kwargs['user'] is still None.
from python-social-auth.
@nmundar, user will be an AnonynousUser
before this line https://github.com/omab/python-social-auth/blob/master/social/actions.py#L56 (actually a little above, before any user = ...
line). And the strategy.authenticate
will always have kwargs['user']
equal to None
unless this is an association with an already created account. Does your custom pipeline entries return anything? Does the process work if you comment those two?
from python-social-auth.
I see no change when i remove custom pipelines, this is how they are implemented
from datetime import datetime
from uuid import uuid4
from urllib2 import urlopen, HTTPError
from django.contrib.auth.models import User
from django.template.defaultfilters import slugify
from django.core.files.base import ContentFile
from models import UserProfile
def get_profile_data(backend, details, response, social_user,
uid, user, *args, **kwargs):
profile, new_user = UserProfile.objects.get_or_create(user=user)
if backend.__class__.__name__ == 'FacebookOAuth2': # changed from FacebookBackend, no effect
if not user.email and response.get('email'):
user.email = response.get('email')
if not profile.gender and response.get('gender'):
profile.gender = response.get('gender')
if not profile.birthday and response.get('birthday'):
datestring = response.get('birthday')
date_format = "%m/%d/%Y"
profile.birthday = datetime.strptime(datestring, date_format)
profile.save()
user.save()
def get_profile_avatar(backend, details, response, social_user,
uid, user, *args, **kwargs):
url = None
profile = user.get_profile()
if not profile.profile_photo:
if backend.__class__.__name__ == 'FacebookOAuth2':
url = "http://graph.facebook.com/%s/picture?type=large" % \
response.get('id')
if url:
try:
avatar = urlopen(url)
rstring = uuid4().get_hex()
profile.profile_photo.save(slugify(rstring + '_p') + '.jpg',
ContentFile(avatar.read()))
profile.save()
except HTTPError:
pass
from python-social-auth.
@nmundar, any luck with this? I don't see any problem with your settings or pipeline methods.
from python-social-auth.
I'm having this exact same problem after migrating from django-social-auth to python-social-auth. do_complete never gets a valid user. It's always None. and partial = partial_pipeline_data(strategy, user, _args, *_kwargs) also returns None. So it always redirects to the login_error page.
I'm not using facbook, but my own backend for Runkeeper. worked like a champ in django-social-auth.
Do you mind looking at my diff to see if you can see the problem?
jasonwaters/fitcompetition@05a0014
from python-social-auth.
I also switched from django-social-auth to python-social-auth and have a problem with very similar symptoms. I was able to track down my problem. Hopefully, this summary will help you guys:
Causes:
- I had an old setting from django-social-auth:
SOCIAL_AUTH_EXTRA_DATA = False
- In the extra_data step of the pipeline, the
backends.oauth.extra_data
function does this concatenation
names = (self.EXTRA_DATA or []) + \
self.setting('EXTRA_DATA', [])
So an exception was thrown because a list is concatenated with a bool and this exception propagated up the stack and eventually invalidated the entire authentication pipeline.
Solution: removing the setting SOCIAL_AUTH_EXTRA_DATA
.
Suggestion: perhaps some note on SOCIAL_AUTH_EXTRA_DATA 's new usage (as list) or its deprecation should be mentioned in the "Porting settings" docs. Also, it looks like backends.oauth.extra_data
is retrieving settings that are list of strings, perhaps we can raise an explicit exception here if EXTRA_DATA is of a different type.
@omab, I can submit a PR but I'm hoping to find out from you first about the role of SOCIAL_AUTH_EXTRA_DATA in this new codebase. Thanks.
from python-social-auth.
Thanks for the comment. Sadly it's not the problem for me. I don't have the SOCIAL_AUTH_EXTRA_DATA setting at all, and it doesn't look like python-social-auth is even getting into the pipeline at all.
from python-social-auth.
So far I wasn't able to reproduce this issue. @jasonwaters could you set a try-except
block around these lines https://github.com/omab/python-social-auth/blob/master/social/backends/base.py#L72-L83 and check if there's any exception raised there?
from python-social-auth.
There was an exception raised:
'social_details() takes at least 2 arguments (2 given)'
see https://www.dropbox.com/s/ci6p5v8255xdscn/Screenshot%202013-11-02%2011.29.47.png
from python-social-auth.
Could you determine the two arguments passed?
from python-social-auth.
There are no arguments passed into social_details(). I traced it to run_pipeline where it calls the method by reflection:
result = func(_args, *_out)
*args is an empty tuple.
https://www.dropbox.com/s/1bxh1g8cyy917sz/Screenshot%202013-11-02%2016.14.24.png
It looks like args are passed down all the way from the response where they originate as an empty tuple. I'm puzzled at this point, since I don't have a clear understanding of how it should work.
from python-social-auth.
I'm pretty much dead in the water on this. Everything was working fine with django-social-auth, but after the switch to python-social-auth I'm stuck. I want to adopt the new library, but it just doesn't work. Anything else I can do to get you information to troubleshoot this issue? My entire project is on github.
from python-social-auth.
@jasonwaters, from the last screenshot social_details()
is getting arguments from **kwargs
. How did you install python-social-auth
, pip or cloning the repository?
from python-social-auth.
@jasonwaters, I was able to reproduce your case and I'm working on a fix
from python-social-auth.
Great news! Thanks. I installed with pip, BTW.
from python-social-auth.
@jasonwaters, I've released v0.1.15
, could you give it a try?
from python-social-auth.
It's working now. Thank's a lot! What was the problem?
from python-social-auth.
Wrong handling of arguments passed to the pipeline.
from python-social-auth.
I managed to catch some time to try to make this work. I've succeded. The problem was actualy in my pipeline due to extra social_user param. I've managed to find it because I've been messing inside django authenticate method which silences exceptions that are due to incorrect number of arguments.
from python-social-auth.
I managed to catch some time to try to make this work. I've succeded. The problem was actualy in my pipeline due to extra social_user param. I've managed to find it because I've been messing inside django authenticate method which silences exceptions that are due to incorrect number of arguments.
What exactly you did ? I don't really understand
from python-social-auth.
Related Issues (20)
- cannot import name 'OpenIdConnectAssociation' HOT 1
- Too bad, casually abandoned HOT 2
- Issue with redirecting page after login using Facebbok for django site
- Support for tokens / secrets in database HOT 1
- VK now demands API version
- python-social-auth - FB login issue HOT 3
- Backend AzureADB2COAuth2 requires 'SOCIAL_AUTH_AZUREAD_B2C_OAUTH2_POLICY' but there is no documentation about this anywhere HOT 2
- 401 Client Error: Authorization Required for url: https://api.twitter.com/oauth/request_token
- 401 Client Error: Authorization Required for url: https://api.twitter.com/oauth/request_token
- 401 Client Error: Authorization Required for url: https://api.twitter.com/oauth/request_token
- Allow exception handling during DEBUG mode
- Facebook login popup from Angular + JWT + DRF
- django.db.migrations.exceptions.NodeNotFoundError: Migration listings.0001_initial dependencies reference nonexistent parent node ('owners', '0001_initial')
- base64.encodestring was deprecated and removed in Python 3.9 . Use encodebytes instead.
- auth
- Is there any example/documentation for IDP initiated SSO in SAML backend? HOT 1
- Better document how the partial pipeline should be handeled HOT 1
- Регистрация через соц сети
- GoogleOpenId is not defined in https://github.com/python-social-auth/social-core/blob/4.5.0/social_core/backends/google.py
- linkedin openid complete endpoint request is stuck
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-social-auth.