Skip to content

Commit 7fd8a2d

Browse files
authored
Merge pull request #488 from saicheems/revert-478-master
2 parents 4a0a6f6 + 39eb47c commit 7fd8a2d

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

appengine/standard/endpoints-frameworks-v2/echo/README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,15 @@ In your web browser, go to the following address: http://localhost:8080/\_ah/api
2323

2424
## Deploying to Google App Engine
2525

26-
Deploy the sample using `gcloud`:
26+
Generate a swagger file by running: `python lib/endpoints/endpointscfg.py get_swagger_spec main.EchoApi --hostname your-service.appspot.com`
27+
28+
To set up OAuth2, replace `your-oauth-client-id.com` under `audiences` in the annotation for `get_user_email` with your OAuth2 client ID. If you want to use Google OAuth2 Playground, use `407408718192.apps.googleusercontent.com` as your audience. To generate a JWT, go to the following address: `https://developers.google.com/oauthplayground`.
29+
30+
Deploy the generated swagger spec to Google Cloud Service Management: `gcloud alpha service-management deploy echo-v1_swagger.json`
31+
32+
Open the `app.yaml` file and in the `env_variables` section, replace `your-service.appspot.com` with your service name, and `2016-08-01r0` with your uploaded service management configuration.
33+
34+
Then, deploy the sample using `gcloud`:
2735

2836
$ gcloud beta app deploy
2937

appengine/standard/endpoints-frameworks-v2/echo/app.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,9 @@ libraries:
2222
version: 2.6
2323
- name: ssl
2424
version: 2.7.11
25+
26+
env_variables:
27+
# Replace with your endpoints service name.
28+
ENDPOINTS_SERVICE_NAME: your-service.appspot.com
29+
# Replace with the version Id of your uploaded Endpoints service.
30+
ENDPOINTS_SERVICE_VERSION: 2016-08-01r0

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ def echo(self, request):
5353
path='echo/getUserEmail',
5454
http_method='GET',
5555
# Require auth tokens to have the following scopes to access this API.
56-
scopes=[endpoints.EMAIL_SCOPE])
56+
scopes=[endpoints.EMAIL_SCOPE],
57+
# OAuth2 audiences allowed in incoming tokens.
58+
audiences=['your-oauth-client-id.com'])
5759
def get_user_email(self, request):
5860
user = endpoints.get_current_user()
5961
# If there's no user defined, the request was unauthenticated, so we

0 commit comments

Comments
 (0)