gadss
gadss

Reputation: 22519

Confused on how to apply google and yahoo OpenID in Django-social-auth

I get django social auth from https://github.com/omab/django-social-auth and follow its instructions.

I am using google oauth and yahoo auth but the problem is that it cant get the first name and lastname of the user so that i wanted to use OpenID to save in the database the first name, last name, email, ect... but in the documentation I can't understand on how to Implement id.

i also went to http://openid.net/get-an-openid/ maybe i can make an app but i can't find on how to do it.

my question is that how can i enable OpenID for google and yahoo in my django?

this is what i have done in my settings.py

AUTHENTICATION_BACKENDS = (
    'userena.backends.UserenaAuthenticationBackend',
    'guardian.backends.ObjectPermissionBackend',
    'django.contrib.auth.backends.ModelBackend',
    'social_auth.backends.facebook.FacebookBackend',
    'social_auth.backends.twitter.TwitterBackend',
    'social_auth.backends.google.GoogleOAuthBackend',
    'social_auth.backends.google.GoogleOAuth2Backend',
    'social_auth.backends.google.GoogleBackend',
    'social_auth.backends.yahoo.YahooBackend',
    'social_auth.backends.OpenIDBackend'
)


#facebook
FACEBOOK_APP_ID              = '45252'
FACEBOOK_API_SECRET          = '234324'
FACEBOOK_EXTENDED_PERMISSIONS = ['email']
#twitter
TWITTER_CONSUMER_KEY = '234324'
TWITTER_CONSUMER_SECRET = '234234'
TWITTER_EXTENDED_PERMISSIONS = ['email']
#google
#GOOGLE_OAUTH2_CLIENT_ID = 23423#''
#GOOGLE_OAUTH2_CLIENT_SECRET = '234324'
#GOOGLE_APP_ID = '23432'
#GOOGLE_APP_KEY = '234'
#GOOGLE_SREG_EXTRA_DATA = ''#[('First name', '...')]
#GOOGLE_AX_EXTRA_DATA = ''# [('...', '...')]
#yahoo
#YAHOO_CONSUMER_KEY = '234342'
#YAHOO_CONSUMER_SECRET = '234234'

when i acccess http://127.0.0.1:8000/associate/google/ or http://127.0.0.1:8000/associate/yahoo/ it goes to the log.in of yahoo or google but it does not logged-in my my django project and when i look to my database, the user is not created...

i think in using OpenID for google and yahoo did not require KEY or ID. so it does not need an app like what i have done in facebook and twitter?

i always got this in my log :

Generated checkid_setup request to https://www.google.com/accounts/o8/ud with assocication AMlYA9XiAAnknkW9He8EyJeKuzgFtnhl9YByYurLWutc80ZtG_5XwbOW
[02/Jun/2012 15:00:23] "GET /associate/google/ HTTP/1.1" 200 2390
Error attempting to use stored discovery information: <openid.consumer.consumer.TypeURIMismatch: Required type http://specs.openid.net/auth/2.0/signon not found in ['http://specs.openid.net/auth/2.0/server', 'http://openid.net/srv/ax/1.0', 'http://specs.openid.net/extensions/ui/1.0/mode/popup', 'http://specs.openid.net/extensions/ui/1.0/icon', 'http://specs.openid.net/extensions/pape/1.0'] for endpoint <openid.consumer.discover.OpenIDServiceEndpoint server_url='https://www.google.com/accounts/o8/ud' claimed_id=None local_id=None canonicalID=None used_yadis=True >>
Attempting discovery to verify endpoint
Performing discovery on https://www.google.com/accounts/o8/id?id=AItOawmyGFHvB71i5EXC9I1dyjOKEXxIPJtHRqM
Received id_res response from https://www.google.com/accounts/o8/ud using association AMlYA9XiAAnknkW9He8EyJeKuzgFtnhl9YByYurLWutc80ZtG_5XwbOW
No handlers could be found for logger "SocialAuth"

do anyone can help me on how can i apply OpenID for google and yahoo in my django project?

thanks in advance ....

Upvotes: 1

Views: 1005

Answers (1)

Vladimir Vlasov
Vladimir Vlasov

Reputation: 2090

I had some problems with implementing OpenID too. SocialAuth gave me error page without any explanation.

After some research, I found that problem was with pipeline setting. In my case I had got errors with my pipeline.py. Some methods was with errors, but django was quiet and didn't log any errors.

Error stopped appearing, when I changed SOCIAL_AUTH_PIPELINE to some simple value:

SOCIAL_AUTH_PIPELINE = (
    'social_auth.backends.pipeline.social.social_auth_user',
    'social_auth.backends.pipeline.associate.associate_by_email',
    'social_auth.backends.pipeline.misc.save_status_to_session',
    'social_auth.backends.pipeline.user.get_username',
    'social_auth.backends.pipeline.user.create_user',
    'social_auth.backends.pipeline.social.associate_user',
    'social_auth.backends.pipeline.social.load_extra_data',
    'social_auth.backends.pipeline.user.update_user_details',
    'social_auth.backends.pipeline.misc.save_status_to_session',
)

This setting was taken from SocialAuth readme.

In summary, if authentication isn't working and log says nothing, problem can be in pipeline (in setting or in methods).

Upvotes: 1

Related Questions