12

The Google APIs python client has special support for the Django and in the examples given by Google (https://developers.google.com/api-client-library/python/guide/django), the class oauth2client.django_orm.Storage is used to store and retrieve Credentials objects.

However, I find lots of examples (https://github.com/jgmize/django-google-drive/tree/master/gdrive/gdoauth2, https://github.com/praekelt/django-google-credentials/tree/master/google_credentials ,etc) put the Credentials in a CredentialsField field of the user's profile,and it is saved into the database.

What are the advantages / disadvantages of the two methods ? Are there preferences ?

Thanx.

yunshi
  • 343
  • 2
  • 10
  • 1
    If anyone is looking at this question in 2020, I'd go with the official Google API method. Honestly -- they look not super different (though I might not totally be understanding the differences). But generally, I'd say if you're using a Google API, they've probably done a decent amount of thinking regarding how to best configure it. – bones225 May 22 '20 at 18:50
  • @bones225 Can you please share the link for *Google API method*? – shaik moeed Jun 06 '20 at 08:19
  • @shaikmoeed looks like the oauth2client has been depricated, https://github.com/googleapis/oauth2client – bones225 Jun 08 '20 at 16:37
  • Does this answer your question? [How can I use Django OAuth Toolkit with Python Social Auth?](https://stackoverflow.com/questions/27051209/how-can-i-use-django-oauth-toolkit-with-python-social-auth) – Mohamed Benkedadra Jun 21 '20 at 01:52

1 Answers1

1

To implementsign in with google feature you can use django-allauth https://django-allauth.readthedocs.io/en/latest/

it provides easy to integrate set of Django applications addressing authentication, registration, account management as well as 3rd party (social) account authentication.

https://django-allauth.readthedocs.io/en/latest/providers.html#google

Gr8ayu
  • 36
  • 4