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
This repository was archived by the owner on Feb 1, 2024. It is now read-only.

Commit 7a5a0c6

Browse filesBrowse files
feat: Set audience field in authenticated HTTP task example (#138)
* Add explicit `audience1 field Unset `audience` will be take the URL as default value. When there are query and fragment parts, this would lead to authentication errors (401). * Add explicit `audience1 field feat: Set `audience` in authenticated HTTP task Unset `audience` will be take the URL as default value. When there are query and fragment parts, this would lead to authentication errors (401). * feat: Add explicit `audience1 field Unset `audience` will be take the URL as default value. When there are query and fragment parts, this would lead to authentication errors (401).
1 parent fd3cb31 commit 7a5a0c6
Copy full SHA for 7a5a0c6

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+4
-2
lines changed

‎samples/snippets/create_http_task_with_token.py

Copy file name to clipboardExpand all lines: samples/snippets/create_http_task_with_token.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def create_http_task(
2121
location,
2222
url,
2323
service_account_email,
24+
audience=None,
2425
payload=None,
2526
):
2627
# [START cloud_tasks_create_http_task_with_token]
@@ -35,7 +36,8 @@ def create_http_task(
3536
# project = 'my-project-id'
3637
# queue = 'my-queue'
3738
# location = 'us-central1'
38-
# url = 'https://example.com/task_handler'
39+
# url = 'https://example.com/task_handler?param=value'
40+
# audience = 'https://example.com/task_handler'
3941
# service_account_email = 'service-account@my-project-id.iam.gserviceaccount.com';
4042
# payload = 'hello'
4143

@@ -47,7 +49,7 @@ def create_http_task(
4749
"http_request": { # Specify the type of request.
4850
"http_method": tasks_v2.HttpMethod.POST,
4951
"url": url, # The full url path that the task will be sent to.
50-
"oidc_token": {"service_account_email": service_account_email},
52+
"oidc_token": {"service_account_email": service_account_email, "audience": audience},
5153
}
5254
}
5355

0 commit comments

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