用于social-auth-core的oauth2后端
social-auth-ragtag-id的Python项目详细描述
python social auth ragtag id
用于python social auth的OAuth2后端。
安装
pipenv install social_auth_ragtag_id
django配置
首先,按照http://python-social-auth.readthedocs.io/en/latest/configuration/django.html中的说明操作。
然后,将其添加到AUTHENTICATION_BACKENDS
:
AUTHENTICATION_BACKENDS=(...'social_auth_ragtag_id.backends.RagtagOAuth2',...'django.contrib.auth.backends.ModelBackend',)
最后,添加客户端ID和密钥:
SOCIAL_AUTH_RAGTAG_KEY='xxxxxxxxxxx'SOCIAL_AUTH_RAGTAG_SECRET='xxxxxxxxxxx'
这些可以从一个衣衫褴褛的工作人员那里获得。
假设默认的url设置来自social_core,您现在可以在/login/ragtag/
登录。
也可以定义SOCIAL_AUTH_RAGTAG_SCOPES
来限制应用程序需要访问哪些数据。在https://id.ragtag.org/api/scopes/可以看到可用的作用域。例如:
SOCIAL_AUTH_RAGTAG_SCOPES=['identity','email']