how to store google oauth token in django : Storage or database
Asked Answered
B

1

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.

Buskin answered 13/10, 2014 at 20:16 Comment(4)
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.Forepaw
@Forepaw Can you please share the link for Google API method?Derby
@shaikmoeed looks like the oauth2client has been depricated, github.com/googleapis/oauth2clientForepaw
Does this answer your question? How can I use Django OAuth Toolkit with Python Social Auth?Climb
G
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

Goofball answered 6/12, 2020 at 12:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.