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
评论列表
文章目录