-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auth samples for Endpoints. #431
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,17 +98,16 @@ Now you can use the client ID to make requests to the API: | |
|
||
The App Engine default service account client demonstrates how to use the Google App Engine default service account to authenticate to endpoints. | ||
We refer to the project that serves API requests as the server project. You also need to create a client project in the [Cloud Console](https://console.cloud.google.com). | ||
Both server and client projects are running Google App Engine standard applications. | ||
|
||
To use the App Engine default service account for authentication: | ||
|
||
1. Update the `gae_default_service_account`'s `x-issuer` and `x-jwks_uri` in `swagger.yaml` with your client project ID. | ||
2. Redeploy your server application. | ||
3. Update clients/service_to_service_gae_default/main.py, replace 'YOUR-CLIENT-PROJECT-ID' and 'YOUR-SERVER-PROJECT-ID' with your client project ID and your server project ID. | ||
4. Upload your application to Google App Engine by invoking the following command under clients/service_to_service_gae_default directory. | ||
This opens a browser window for you to sign in using your Google account. You'll be providing the project ID as the argument for -A. Use | ||
the -V argument to specify a version name. Additional information on how to deploy an app to Google Cloud App Engine can be found [here](https://cloud.google.com/appengine/docs/python/quickstart). | ||
4. Upload your application to Google App Engine by invoking the following command. | ||
|
||
appcfg.py -A <YOUR-CLIENT-PROJECT-ID> -V v1 update . | ||
gcloud app deploy app.yaml --project=<YOUR-CLIENT-PROJECT-ID> --promote | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Neither |
||
|
||
Your client app is now deployed at https://<YOUR-CLIENT-PROJECT-ID>.appspot.com. When you access https://<YOUR-CLIENT-PROJECT-ID>.appspot.com, your client calls your server project API using | ||
the client's service account. | ||
|
@@ -117,6 +116,7 @@ the client's service account. | |
|
||
The service account client demonstrates how to use a non-default service account to authenticate to endpoints. | ||
We refer to the project that serves API requests as the server project. You also need to create a client project in the [Cloud Console](https://console.cloud.google.com). | ||
Both server and client projects are running Google App Engine standard applications. | ||
|
||
In the example, we use Google Cloud Identity and Access Management (IAM) API to create a JSON Web Token (JWT) for a service account, and use it to call an Endpoints API. | ||
|
||
|
@@ -134,11 +134,9 @@ To use the client for authentication: | |
2. Redeploy your server application. | ||
3. Update clients/service_to_service_non_default/main.py, replace 'YOUR-SERVICE-ACCOUNT-EMAIL', 'YOUR-SERVER-PROJECT-ID' and 'YOUR-CLIENT-PROJECT-ID' | ||
with your service account email, your server project ID, and your client project ID. | ||
4. Upload your application to Google App Engine by invoking the following command under clients/service_to_service_non_default directory. | ||
This opens a browser window for you to sign in using your Google account. You'll be providing the project ID as the argument for -A. Use | ||
the -V argument to specify a version name. Additional information on how to deploy an app to Google Cloud App Engine can be found [here](https://cloud.google.com/appengine/docs/python/quickstart). | ||
4. Upload your application to Google App Engine by invoking the following command. | ||
|
||
appcfg.py -A <YOUR-CLIENT-PROJECT-ID> -V v1 update . | ||
gcloud app deploy app.yaml --project=<YOUR-CLIENT-PROJECT-ID> --promote | ||
|
||
Your client app is now deployed at https://<YOUR-CLIENT-PROJECT-ID>.appspot.com. When you access https://<YOUR-CLIENT-PROJECT-ID>.appspot.com, your client calls your server project API using | ||
the client's service account. | ||
|
@@ -150,16 +148,15 @@ In the example, we first create a JSON Web Token (JWT) using the App Engine defa | |
ID token using the JWT, and call an Endpoints API using the Google ID token. | ||
|
||
We refer to the project that serves API requests as the server project. You also need to create a client project in the [Cloud Console](https://console.cloud.google.com). | ||
Both server and client projects are running Google App Engine standard applications. | ||
|
||
To use the client for authentication: | ||
1. Update the `google_id_token`'s audiences, replace `YOUR-SERVER-PROJECT-ID` with your server project ID. | ||
2. Redeploy your server application. | ||
3. Update clients/service_to_service_google_id_token/main.py, replace 'YOUR-CLIENT-PROJECT-ID' and 'YOUR-SERVER-PROJECT-ID' with your client project ID and your server project ID. | ||
4. Upload your application to Google App Engine by invoking the following command under clients/service_to_service_google_id_token directory. | ||
This opens a browser window for you to sign in using your Google account. You'll be providing the project ID as the argument for -A. Use | ||
the -V argument to specify a version name. Additional information on how to deploy an app to Google Cloud App Engine can be found [here](https://cloud.google.com/appengine/docs/python/quickstart). | ||
4. Upload your application to Google App Engine by invoking the following command. | ||
|
||
appcfg.py -A <YOUR-CLIENT-PROJECT-ID> -V v1 update . | ||
gcloud app deploy app.yaml --project=<YOUR-CLIENT-PROJECT-ID> --promote | ||
|
||
Your client app is now deployed at https://<YOUR-CLIENT-PROJECT-ID>.appspot.com. When you access https://<YOUR-CLIENT-PROJECT-ID>.appspot.com, your client calls your server project API from | ||
the client's service account using Google ID token. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ gcloud==0.17.0 | |
six==1.10.0 | ||
pyyaml==3.11 | ||
requests==2.10.0 | ||
google-api-python-client | ||
google-api-python-client==1.5.1 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the server application running on standard? The server sample (in the directory above) uses Flexible.