Dash谷歌认证电子邮件
dash-google-auth-email的Python项目详细描述
#dash google auth email
dash google auth email是一个使用google oauth进行身份验证和查看[dash]应用程序的简单库。这个项目几乎完全源于parernt项目[dash google auth](https://github.com/lchapo/dash google auth)
这个库使用[flask dance](https://github.com/singinwolfboy/flask dance)
和plotly自己的[dash auth]的修改版本(https://github.com/plotly/dash auth)
进行身份验证。
use
可以使用“google oauth”类将身份验证添加到Dash应用程序中,即从Dash导入Dash
``python
from Dash导入Dash
from Flask导入Flask
from Dash Google Auth电子邮件导入GoogleOAuth
server=Flask( server.config.update({
“Google OAuth客户端ID”:…,
“google_auth_client_secret”:…,
})
app=dash(u name_uu,server=server,url_base_u pathname='/',auth='auth')
authorized_emails=[…]
附加的_u scopes=[…]
auth=google oauth(app,authorized_emails,附加范围)
使用“pip”安装“dash google auth email”库:
```bash
$pip安装dash google auth email
```
>2。按照[烧瓶舞指南](http://flask dance.readthedocs.io/en/latest/quickstarts/google.html)在google管理控制台上创建一个应用程序。复制[app.py](https://github.com/ricklentz/dash google auth email/blob/master/app.py)并设置变量(或设置相应的环境变量):
``python
server.config[“google庠oauth庠client庠id”]=…
server.config[“google庠oauth庠client庠secret”]=…
```
google oauth 2 client您应该在步骤1中设置。
如果设置正确,可以在**oauth 2.0 client id**部分的
[API&Services>;凭据](https://console.developers.google.com/api/credentials)
找到它们。将app.py中的“authorized_emails”替换为您要授予对应用程序访问权限的任何
google电子邮件。在生产中,我建议从数据库中获取这些信息。运行“python app.py”,并在
浏览器窗口中打开[localhost](http://localhost:8050/)进行尝试!如果应用程序在没有提示Google登录的情况下自动加载,这意味着您已经通过了身份验证--如果您想查看新用户的登录体验,请尝试使用“匿名”窗口。
dash google auth email是一个使用google oauth进行身份验证和查看[dash]应用程序的简单库。这个项目几乎完全源于parernt项目[dash google auth](https://github.com/lchapo/dash google auth)
这个库使用[flask dance](https://github.com/singinwolfboy/flask dance)
和plotly自己的[dash auth]的修改版本(https://github.com/plotly/dash auth)
进行身份验证。
use
可以使用“google oauth”类将身份验证添加到Dash应用程序中,即从Dash导入Dash
``python
from Dash导入Dash
from Flask导入Flask
from Dash Google Auth电子邮件导入GoogleOAuth
server=Flask(
“Google OAuth客户端ID”:…,
“google_auth_client_secret”:…,
})
app=dash(u name_uu,server=server,url_base_u pathname='/',auth='auth')
authorized_emails=[…]
附加的_u scopes=[…]
auth=google oauth(app,authorized_emails,附加范围)
使用“pip”安装“dash google auth email”库:
```bash
$pip安装dash google auth email
```
>2。按照[烧瓶舞指南](http://flask dance.readthedocs.io/en/latest/quickstarts/google.html)在google管理控制台上创建一个应用程序。复制[app.py](https://github.com/ricklentz/dash google auth email/blob/master/app.py)并设置变量(或设置相应的环境变量):
``python
server.config[“google庠oauth庠client庠id”]=…
server.config[“google庠oauth庠client庠secret”]=…
```
google oauth 2 client您应该在步骤1中设置。
如果设置正确,可以在**oauth 2.0 client id**部分的
[API&Services>;凭据](https://console.developers.google.com/api/credentials)
找到它们。将app.py中的“authorized_emails”替换为您要授予对应用程序访问权限的任何
google电子邮件。在生产中,我建议从数据库中获取这些信息。运行“python app.py”,并在
浏览器窗口中打开[localhost](http://localhost:8050/)进行尝试!如果应用程序在没有提示Google登录的情况下自动加载,这意味着您已经通过了身份验证--如果您想查看新用户的登录体验,请尝试使用“匿名”窗口。