Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 32f96e4

Browse filesBrowse files
authored
Update render.py (GoogleCloudPlatform#4415)
Removing the "unauthenticated mode" - it's no longer necessary now that we're using the google-auth library.
1 parent 2024091 commit 32f96e4
Copy full SHA for 32f96e4

File tree

Expand file treeCollapse file tree

1 file changed

+4
-8
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-8
lines changed

‎run/markdown-preview/editor/render.py

Copy file name to clipboardExpand all lines: run/markdown-preview/editor/render.py
+4-8Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,14 @@ def new_request(data):
3131
if not url:
3232
raise Exception("EDITOR_UPSTREAM_RENDER_URL missing")
3333

34-
unauthenticated = os.environ.get("EDITOR_UPSTREAM_UNAUTHENTICATED", False)
35-
3634
req = urllib.request.Request(url, data=data.encode())
3735

3836
credentials, project = google.auth.default()
37+
auth_req = google.auth.transport.requests.Request()
38+
target_audience = url
3939

40-
if not unauthenticated:
41-
auth_req = google.auth.transport.requests.Request()
42-
target_audience = url
43-
44-
id_token = google.oauth2.id_token.fetch_id_token(auth_req, target_audience)
45-
req.add_header("Authorization", f"Bearer {id_token}")
40+
id_token = google.oauth2.id_token.fetch_id_token(auth_req, target_audience)
41+
req.add_header("Authorization", f"Bearer {id_token}")
4642

4743
response = urllib.request.urlopen(req)
4844
return response.read()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.