Je suis en train d'ajouter l'authentification Google à mon projetComment utiliser python-social-auth avec google seulement?
Je l'ai installé:
pip install python-social-auth
et ajouté dans settings.py:
SOCIAL_AUTH_USER_MODEL = 'accounts.CustomUser'##
SOUTH_MIGRATION_MODULES = {
'default': 'social.apps.django_app.default.south_migrations'
}
AUTHENTICATION_BACKENDS = (
'myproject.middleware.AuthenticationCMSBackend',##
'social.backends.google.GoogleOpenId',
'social.backends.google.GoogleOAuth2',
'django.contrib.auth.backends.ModelBackend',
)
LOGIN_REDIRECT_URL = '/'
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '507847...m.apps.googleusercontent.com'
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'SEt-6...0j3'"""
TEMPLATE_CONTEXT_PROCESSORS = (
...
'django.core.context_processors.request',
'social.apps.django_app.context_processors.backends',
'social.apps.django_app.context_processors.login_redirect',
)
Quant au SOCIAL_AUTH_GOOGLE_OAUTH2_KEY et secert, Je suis allé à https://console.developers.google.com/apis/credentials et les ai créés en utilisant localhost url (pour tester pour l'instant)
Je l'appelle en templ mangé comme ceci:
<a href="{% url 'social:begin' 'google-oauth2' %}"> login </a>
Mais je reçois cette erreur:
Backend not found
Qu'est-ce que je fais mal?
prochaine étape, je veux m'assurer que seuls les utilisateurs que je valide peuvent authentifier n'importe qui avec un compte google, comment le faire?
C'est exactement ce que je fais comme je l'ai posté! Quelle est la différence? que dois-je corriger? – cinoch