Skip to content

Commit 35e8cab

Browse files
tomboctswast
authored andcommitted
Add a list of allowed_client_ids to EchoApi.get_user_email. (#1992)
The use of an OAuth token issued by accounts.google.com triggers a special path in Endpoints Framework, which validates if the client id ('azp' claim of JWT token) is included in allowed_client_ids list supplied to @endpoints.method decorator. Without the change, sample client described at [1] receives 401 Unauthorized errors when attempting to access the API. [1] https://cloud.google.com/endpoints/docs/frameworks/python/javascript-client
1 parent 014d40b commit 35e8cab

File tree

1 file changed

+2
-1
lines changed
  • appengine/standard/endpoints-frameworks-v2/echo

1 file changed

+2
-1
lines changed

appengine/standard/endpoints-frameworks-v2/echo/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ def echo_api_key(self, request):
9292
# Require auth tokens to have the following scopes to access this API.
9393
scopes=[endpoints.EMAIL_SCOPE],
9494
# OAuth2 audiences allowed in incoming tokens.
95-
audiences=['your-oauth-client-id.com'])
95+
audiences=['your-oauth-client-id.com'],
96+
allowed_client_ids=['your-oauth-client-id.com'])
9697
def get_user_email(self, request):
9798
user = endpoints.get_current_user()
9899
# If there's no user defined, the request was unauthenticated, so we

0 commit comments

Comments
 (0)