django-google-auth2 project is demo application for google auth
Project description
=====
django-google-auth
=====
django-google-auth project is demo application for codingsoho
Detailed documentation is in the "docs" directory.
Quick start
-----------
# googleauth
1. 安装 django-google-auth2
```
pip3 install django-google-auth2
```
2. 添加 django_google_auth2 到app
```
INSTALLED_APPS = [
...
'django_google_auth2',
]
```
3. 绑定google令牌
```
from django_google_auth2.google.bindgoogleauth.bindgoogleauth import bind_google_auth
bind_google_auth(user)
```
**函数参数:**
|参数名|必选|类型|说明|
|:---- |:---|:----- |----- |
|user |是 |string | 用户名 Or 邮箱 |
**返回参数说明**
|参数名|类型|说明|
|:----- |:-----|----- |
|success |bool | True/False |
|data |string | google令牌字符串(用于生成二维码) |
4. 解绑google令牌
```
from django_google_auth2.google.deletegoogleauth.deletegoogleauth import delete_google_auth
delete_google_auth(user)
```
**函数参数:**
|参数名|必选|类型|说明|
|:---- |:---|:----- |----- |
|user |是 |string | 用户名 Or 邮箱 |
**返回参数说明**
|参数名|类型|说明|
|:----- |:-----|-----|
|success |bool | True/False |
|data |string | 删除成功 |
5. 验证google令牌
```
from django_google_auth2.google.checkgoogleauth.checkgoogleauth import check_google_auth
check_google_auth(user,code)
```
**函数参数:**
|参数名|必选|类型|说明|
|:---- |:---|:----- |----- |
|user |是 |string | 用户名 Or 邮箱 |
|code |是 |string | 客户端动态码 |
**返回参数说明**
|参数名|类型|说明|
|:----- |:-----|-----|
|success |bool | True/False |
6. 绑定google令牌Api接口
urls.py
```
from django_google_auth2.google.bindgoogleauth.bindgoogleauthapi import bind_google_auth_api
urlpatterns = [
...
path('bing-google-auth-api/', bind_google_auth_api),
]
```
**请求方式:**
- POST
**请求示例**
```
{
"user":"cox"
}
```
**函数参数:**
|参数名|必选|类型|说明|
|:---- |:---|:----- |----- |
|user |是 |string | 用户名 Or 邮箱 |
**返回**
![20190402192923-image.png](https://raw.githubusercontent.com/Coxhuang/yosoro/master/20190402192923-image.png)
7. 客户端(二选一)
> 安卓App
Google令牌+扫码器(如果手机只安装Google令牌App扫码失败,请安装扫码器)
链接:https://pan.baidu.com/s/1XeO7p4IvNuvzQOiZrq4wtw
提取码:e70f
> Chrome插件
https://chrome.google.com/webstore/detail/authenticator/bhghoamapcdpbohphigoooaddinpkbai
django-google-auth
=====
django-google-auth project is demo application for codingsoho
Detailed documentation is in the "docs" directory.
Quick start
-----------
# googleauth
1. 安装 django-google-auth2
```
pip3 install django-google-auth2
```
2. 添加 django_google_auth2 到app
```
INSTALLED_APPS = [
...
'django_google_auth2',
]
```
3. 绑定google令牌
```
from django_google_auth2.google.bindgoogleauth.bindgoogleauth import bind_google_auth
bind_google_auth(user)
```
**函数参数:**
|参数名|必选|类型|说明|
|:---- |:---|:----- |----- |
|user |是 |string | 用户名 Or 邮箱 |
**返回参数说明**
|参数名|类型|说明|
|:----- |:-----|----- |
|success |bool | True/False |
|data |string | google令牌字符串(用于生成二维码) |
4. 解绑google令牌
```
from django_google_auth2.google.deletegoogleauth.deletegoogleauth import delete_google_auth
delete_google_auth(user)
```
**函数参数:**
|参数名|必选|类型|说明|
|:---- |:---|:----- |----- |
|user |是 |string | 用户名 Or 邮箱 |
**返回参数说明**
|参数名|类型|说明|
|:----- |:-----|-----|
|success |bool | True/False |
|data |string | 删除成功 |
5. 验证google令牌
```
from django_google_auth2.google.checkgoogleauth.checkgoogleauth import check_google_auth
check_google_auth(user,code)
```
**函数参数:**
|参数名|必选|类型|说明|
|:---- |:---|:----- |----- |
|user |是 |string | 用户名 Or 邮箱 |
|code |是 |string | 客户端动态码 |
**返回参数说明**
|参数名|类型|说明|
|:----- |:-----|-----|
|success |bool | True/False |
6. 绑定google令牌Api接口
urls.py
```
from django_google_auth2.google.bindgoogleauth.bindgoogleauthapi import bind_google_auth_api
urlpatterns = [
...
path('bing-google-auth-api/', bind_google_auth_api),
]
```
**请求方式:**
- POST
**请求示例**
```
{
"user":"cox"
}
```
**函数参数:**
|参数名|必选|类型|说明|
|:---- |:---|:----- |----- |
|user |是 |string | 用户名 Or 邮箱 |
**返回**
![20190402192923-image.png](https://raw.githubusercontent.com/Coxhuang/yosoro/master/20190402192923-image.png)
7. 客户端(二选一)
> 安卓App
Google令牌+扫码器(如果手机只安装Google令牌App扫码失败,请安装扫码器)
链接:https://pan.baidu.com/s/1XeO7p4IvNuvzQOiZrq4wtw
提取码:e70f
> Chrome插件
https://chrome.google.com/webstore/detail/authenticator/bhghoamapcdpbohphigoooaddinpkbai
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-google-auth2-0.0.6.tar.gz
(14.2 kB
view hashes)
Close
Hashes for django-google-auth2-0.0.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7680f4e7a166cf1106818aae3fe700fb56224cc18a05e455e943fd5cd04e9f63 |
|
MD5 | 9f340cc3e92a5367daadf79ffca45aa2 |
|
BLAKE2b-256 | 2165475616ef183f94fee3486104a2de2a359fc5d3d3f43f06d51983a18f7038 |