1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-12-26 10:00:37 +00:00
This commit is contained in:
OzzieIsaacs 2018-07-25 21:56:25 +02:00
parent f8c9777668
commit 9d161129d9

View File

@ -1508,14 +1508,14 @@ def delete_book(book_id):
@login_required @login_required
@admin_required @admin_required
def authenticate_google_drive(): def authenticate_google_drive():
authUrl = Gauth.Instance().auth.GetAuthUrl() authUrl = gdriveutils.Gauth.Instance().auth.GetAuthUrl()
return redirect(authUrl) return redirect(authUrl)
@app.route("/gdrive/callback") @app.route("/gdrive/callback")
def google_drive_callback(): def google_drive_callback():
auth_code = request.args.get('code') auth_code = request.args.get('code')
credentials = Gauth.Instance().auth.flow.step2_exchange(auth_code) credentials = gdriveutils.Gauth.Instance().auth.flow.step2_exchange(auth_code)
with open(os.path.join(config.get_main_dir,'gdrive_credentials'), 'w') as f: with open(os.path.join(config.get_main_dir,'gdrive_credentials'), 'w') as f:
f.write(credentials.to_json()) f.write(credentials.to_json())
return redirect(url_for('configuration')) return redirect(url_for('configuration'))