GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — java-docs-samples/appengine-java8/oauth2 at master · thanakorntr/java-docs-samples

Expand file tree

/

oauth2

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

oauth2

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
src/main
src/main
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

README.md

Outline

Google App Engine Standard Environment

Open in Cloud Shell

Oauth2 Sample

This sample demonstrates using the Oauth2 apis to create an authenticaion filter.

See the Google App Engine standard environment documentation for more detailed instructions.

Setup

  1. In the Cloud Developers Console > API Manager > Credentials, create a Oauth Client ID for a Web Application. You will need to provide an authroized JavaScript origin. Typically, https://projectID.appspot.com.
  2. Edit src/main/webapp/index.html and change YOUR_CLIENT_ID_HERE.apps.googleusercontent.com to Client ID from the prior step.

Running locally

NOTE: The app can be run locally, but the Oauth2 APIs do not work with the development server.

$ mvn appengine:run

Deploying

$ mvn appengine:update -Dappengine.appId=YOUR-PROJECT-ID -Dappengine.version=SOME-VERSION
  1. Using your browser, visit https://YOUR-PROJECT-ID.appspot.com, click Sign In.

  2. The Sign In process will then request some text from your app, and then display it, if the id matches the list in src/main/java/com/example/appengine/Oauth2Filter.java.

Adding you to the list of valid users

NOTE: Typically, you would use this for Service Accounts, but user accounts work as well.

  1. Enable logging by uncommenting the context.log line in src/main/java/com/example/appengine/Oauth2Filter.java, redeploy, and visit the page

  2. Look at the logs in Cloud Developers Console > Logs.

  3. Add the tokenAudience to the allowedClients.

  4. Deploy and visit the page again.

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.