Skip to main content
=====
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

Metadata

Release files for django-google-auth2 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-google-auth2 0.0.8
File Size Uploaded
django-google-auth2-0.0.8.tar.gz 14.3 kB Details

Release files / django-google-auth2-0.0.8.tar.gz

Download URL django-google-auth2-0.0.8.tar.gz
Size 14.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d0b46bbb687d43998b1aa6b4546b91dad85935cbcde75cbbef13935be89d5a6e
BLAKE2b-256 checksum
How to use checksums
91f9d1c976139e019ce5b82be4718740bc3f0a75ed8bb311c411f5b0ae7cf76b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.4

Release history Release notifications | RSS feed

This release

0.0.8 This release

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page