django - Using Python-social-auth the social-user is not being set in the pipeline -


attributeerror @ /complete/google-oauth2/  'nonetype' object has no attribute 'provider' 

this happens new or registered user @ line https://github.com/omab/python-social-auth/blob/master/social/actions.py#l69 , new problem. appeared when playing around custom pipeline worked before, reverting basic python-social-auth set doesn't work.

even reloaded database , refreshed syncdb. (this django 1.4.20, old project we're upgrading).

the problem clear, wherever in default pipeline social-user meant set on user not working, don't understand python-social-auth code enough , going around in circles here. pointers or appreciated here.

the 500 appears in stack trace in case it's help.

[23/jul/2015 12:00:32] "get /complete/google-oauth2/?state=mrfnoqg6cv5cmb1xqdcp53c33ddrff7c&code=4/2bgjgygxftqb2c10binigkiggfy4znosybqyhbudlgo&authuser=0&prompt=consent&session_state=4c6c24bdd3100a506c4744be8ab9b793ed6399d5..a5f9 http/1.1" 500 148571 

this data code chokes on, it's because previous part of pipeline doesn't put "social_user" user. don't know failing that, more familiar have suggestions default pipeline might fail?

partial none is_authenticated    false args    () is_new  false redirect_value  '' user    <user: 4o5bb5o5> social_user none kwargs  {} login   <function _do_login @ 0xaef3de9c> backend <social.backends.google.googleoauth2 object @ 0x9e68fac> data    <querydict: {u'state': [u'dwmohkbxsvgvj4mwl54lxqihzjvymwtv'], u'code': [u'4/fjovlvyak5ms_mcv7uhvwqsfycpjlbb_yoy4f7omiiy'], u'prompt': [u'none'], u'session_state': [u'ab65081ee8e4a3720d5963deced4cabc7b259a85..8f10'], u'authuser': [u'0']}> redirect_name    'next' 

when navigate home page i'm logged in fine gmail account. (although of post_save functions meant happen after create_user don't trigger, assume that's cos crashed in middle of pipeline). when log out , in again crashes again on same page.

may late others. have used in custom app.

as shown here, id_key set none , here saw pdb id_key set id. naturally framework expecting id 1 of key in response server during user_data.

this custom backend looks like,

class customoauth2(baseoauth2):     """custom oauth authentication backend"""     name = 'custom'     id_key = 'email'  #<===== set unique attribute if id not returned     authorization_url = 'https://auth.custom.org/oauth2/authorize'     access_token_url = 'https://auth.custom.org/oauth2/token'     access_token_method = 'post'     revoke_token_url = '= https://auth.custom.org/oauth2/revoke'     revoke_token_method = 'post'     user_data_url = "https://api.custom.org/user/"     scope_separator = ','      def get_user_details(self, response):         """return user details custom account"""         return {'username': response.get('login'),                 'email': response.get('email') or '',                 'first_name': response.get('name')}      def user_data(self, access_token, *args, **kwargs):         """loads user data service"""         try:             headers = {'authorization': 'bearer %s' %access_token}             headers['accept'] = 'application/json'             response = requests.get(self.user_data_url, headers=headers)             d = json.loads(response.content)             return d          except valueerror:             return none 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -