Spaces:
Runtime error
Runtime error
removing dev settings
Browse files
app.py
CHANGED
@@ -40,15 +40,15 @@ async def authorize(request: Request):
|
|
40 |
)
|
41 |
|
42 |
# for dev
|
43 |
-
flow.redirect_uri = "http://127.0.0.1:8000/auth_callback"
|
44 |
# for production
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
|
53 |
authorization_url, state = flow.authorization_url(
|
54 |
access_type="offline",
|
@@ -66,15 +66,15 @@ async def auth_callback(request: Request):
|
|
66 |
"credentials.json", scopes=SCOPES, state=state
|
67 |
)
|
68 |
# for dev
|
69 |
-
flow.redirect_uri = "http://127.0.0.1:8000/auth_callback"
|
70 |
# for production
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
|
79 |
# Use the authorization server's response to fetch the OAuth 2.0 tokens.
|
80 |
authorization_response = str(request.url)
|
|
|
40 |
)
|
41 |
|
42 |
# for dev
|
43 |
+
# flow.redirect_uri = "http://127.0.0.1:8000/auth_callback"
|
44 |
# for production
|
45 |
+
flow.redirect_uri = (
|
46 |
+
request.url.scheme
|
47 |
+
+ "://"
|
48 |
+
+ request.url.hostname
|
49 |
+
+ (":" + str(request.url.port) if request.url.port else "")
|
50 |
+
+ app.url_path_for("auth_callback")
|
51 |
+
)
|
52 |
|
53 |
authorization_url, state = flow.authorization_url(
|
54 |
access_type="offline",
|
|
|
66 |
"credentials.json", scopes=SCOPES, state=state
|
67 |
)
|
68 |
# for dev
|
69 |
+
# flow.redirect_uri = "http://127.0.0.1:8000/auth_callback"
|
70 |
# for production
|
71 |
+
flow.redirect_uri = (
|
72 |
+
request.url.scheme
|
73 |
+
+ "://"
|
74 |
+
+ request.url.hostname
|
75 |
+
+ (":" + str(request.url.port) if request.url.port else "")
|
76 |
+
+ app.url_path_for("auth_callback")
|
77 |
+
)
|
78 |
|
79 |
# Use the authorization server's response to fetch the OAuth 2.0 tokens.
|
80 |
authorization_response = str(request.url)
|