oauth_utils.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:diycrate 作者: jheld 项目源码 文件源码
def oauth_dance(redis_client, conf, bottle_app, file_event_handler, bottle_thread=None):
    diycrate_secret_key = redis_client.get('diycrate_secret_key') or str(uuid.uuid4())
    if not redis_client.exists('diycrate_secret_key'):
        redis_client.set('diycrate_secret_key', diycrate_secret_key)
    bottle_app.oauth = file_event_handler.oauth = setup_remote_oauth(redis_client)
    import requests
    auth_url, bottle_app.csrf_token = requests.get(conf['box']['authorization_url'], data={'redirect_url': 'https://localhost:8080/', }, verify=False).json()
    # auth_url, bottle_app.csrf_token = bottle_app.oauth.get_authorization_url(auth_url)
    if bottle_thread and not bottle_thread.is_alive():
        bottle_thread.start()
    webbrowser.open_new_tab(auth_url)  # make it easy for the end-user to start auth
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号