使用auth0对用户进行身份验证。
django-auth0-auth的Python项目详细描述
django auth0 auth
===
*django auth0 auth*允许您通过auth0进行身份验证。
安装
----
run`pip install django-auth0-auth`
将“auth0backend”添加到“authentication-backends”设置:
``python
authentication-backends=(
…
'auth0_auth.backends.auth0 backend',
)
````
``python
urlpatterns=[
url(r'^auth0/',include('auth0_auth.urls'),
...
]
```
Settings
--------
###AUTH0_DOMAIN
Auth0 domain.
###AUTH0_CLIENT_ID
Auth0 client id.
###AUTH0_CLIENT_SECRET
Auth0 client secret.
###AUTH0_SECRET_BASE64_ENCODED
**default:** `False`
Flag if Auth0 client secret is base64
**默认值:*`'openid email`
oauth scope参数。
35 35;auth0_user_creation
**默认值:**`true`
成功后允许创建新用户身份验证。
要使用基于javascript的**锁定**对话框登录,请将以下内容添加到项目中。
将“auth0”上下文处理器添加到“templates”选项中。
``python
templates=[
{
“backend”:“django.template.backends.django.djangotemplates”,
“dirs”:[os.path.join(base-dir,“templates”)],
“options”:{
“context-processors”:[
…
“auth0-auth.context-processors.auth0”,
],
},
},
]
`````
将以下javascript代码片段添加到站点下面的“base.html”中其他javascript。
<;script src=“https://cdn.auth0.com/js/lock-9.min.js”>;
<;script type=“text/javascript”>;
var lock=new auth0lock('{auth0\'u client\'id}','{{auth0\'u domain}');
函数signin(){
lock.show({
callback url:'{{auth0_callback_url}}',
responsetype:'令牌',
authparams:{
'作用域':'{{auth0_scope}',
'响应模式':'表单'
“state”:{{auth0_state}'
}
};
}
}
`选项。
`` python
日志记录={
…,
'日志记录者':{
…,
'身份验证':{
'处理程序':['控制台',
'级别':'调试',
}
}
}
}
```
===
*django auth0 auth*允许您通过auth0进行身份验证。
安装
----
run`pip install django-auth0-auth`
将“auth0backend”添加到“authentication-backends”设置:
``python
authentication-backends=(
…
'auth0_auth.backends.auth0 backend',
)
````
``python
urlpatterns=[
url(r'^auth0/',include('auth0_auth.urls'),
...
]
```
Settings
--------
###AUTH0_DOMAIN
Auth0 domain.
###AUTH0_CLIENT_ID
Auth0 client id.
###AUTH0_CLIENT_SECRET
Auth0 client secret.
###AUTH0_SECRET_BASE64_ENCODED
**default:** `False`
Flag if Auth0 client secret is base64
**默认值:*`'openid email`
oauth scope参数。
35 35;auth0_user_creation
**默认值:**`true`
成功后允许创建新用户身份验证。
要使用基于javascript的**锁定**对话框登录,请将以下内容添加到项目中。
将“auth0”上下文处理器添加到“templates”选项中。
``python
templates=[
{
“backend”:“django.template.backends.django.djangotemplates”,
“dirs”:[os.path.join(base-dir,“templates”)],
“options”:{
“context-processors”:[
…
“auth0-auth.context-processors.auth0”,
],
},
},
]
`````
将以下javascript代码片段添加到站点下面的“base.html”中其他javascript。
<;script src=“https://cdn.auth0.com/js/lock-9.min.js”>;
<;script type=“text/javascript”>;
var lock=new auth0lock('{auth0\'u client\'id}','{{auth0\'u domain}');
函数signin(){
lock.show({
callback url:'{{auth0_callback_url}}',
responsetype:'令牌',
authparams:{
'作用域':'{{auth0_scope}',
'响应模式':'表单'
“state”:{{auth0_state}'
}
};
}
}
`选项。
`` python
日志记录={
…,
'日志记录者':{
…,
'身份验证':{
'处理程序':['控制台',
'级别':'调试',
}
}
}
}
```