Skip to content

Commit a3376fe

Browse files
authored
Revert "Temporarily remove some sample features"
1 parent 4a0a6f6 commit a3376fe

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
This demonstrates how to use Google Cloud Endpoints Frameworks v2 on Google App Engine Standard Environment using Python.
44

5+
This sample consists of two parts:
6+
7+
1. The backend
8+
2. The clients
9+
510
## Setup
611

712
Create a `lib` directory in which to install the Endpoints Frameworks v2 library. For more info, see [Installing a library](https://cloud.google.com/appengine/docs/python/tools/using-libraries-python-27#installing_a_library).
@@ -23,7 +28,15 @@ In your web browser, go to the following address: http://localhost:8080/\_ah/api
2328

2429
## Deploying to Google App Engine
2530

26-
Deploy the sample using `gcloud`:
31+
Generate a swagger file by running: `endpointscfg.py get_swagger_spec main.EchoApi --hostname your-service.appspot.com`
32+
33+
To set up OAuth2, replace `your-oauth-client-id.com` under the `x-security` section in `echo-v1_swagger.json` 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`.
34+
35+
Deploy the generated swagger spec to Google Cloud Service Management: `gcloud alpha service-management deploy echo-v1_swagger.json`
36+
37+
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.
38+
39+
Then, deploy the sample using `gcloud`:
2740

2841
$ gcloud beta app deploy
2942

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)