0

I am using the Django package django_openid_auth and this snippet of code to authenticate a user in Django via his OpenID.

This works perfectly. The user is redirected to the Google Accounts page to obtain the permission, then is redirected back.

However, this only servers to obtain the user's email/fist name/last name. If I want to obtain the list of contacts of the user, or even sensible information such as date of birth or avatar, how does that work?

I assume that, since I'm obtaining the email/names via the OpenID AX extension, I can similarly obtain OAuth information using the Ext2 extension?

I know the Google Contacts API needs OAuth authentication. Since I'm signing in with OpenID, is this OAuth authentication included, or must I do it in a new separate process? So in short, is this OpenID authentication including the authentication process for obtaining contacts/account info, or must I authenticate and use a separate process?

The internal mechanics of the OpenID mechanism used are in the django_openid_auth module.

Can somebody point me in the right direction? Thank you.

1 Answers1

1

I think you should think about using OAuth2 instead of the hybrid of OpenID2 and OAuth 1. It is possible to do it with the latter, but it's MUCH easier to use OAuth2. I'm not up on specific OAuth2 libraries for Django, but the Python OAuth2 library that Google has authored is 'state of the art'. It even has info on using it with Django

https://developers.google.com/api-client-library/python/guide/aaa_oauth

This library will let you ask for the contacts scope, as well as the userinfo.profile scope that you are interested in.

hope this helps.

davep

David Primmer
  • 421
  • 2
  • 7