Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Outline

Google OAuth 2.0 on Google App Engine Standard with Java 11

This sample shows how to implement an OAuth 2.0 flow using the Google OAuth Client Library for Java to access protected data stored on Google services. OAuth 2.0 is a standard specification for allowing end users to securely authorize a client application to access protected server-side resources.

Setup you Google Cloud Project

  • Make sure gcloud is installed and initialized:
   gcloud init
  • If this is the first time you are creating an App Engine project
   gcloud app create

Setup the Sample App

  • Copy the sample apps to your local machine:
  git clone https://github.com/GoogleCloudPlatform/java-docs-samples
  cd java-docs-samples/appengine-java11/appengine-simple-jetty-main
  mvn install
  • In the Cloud Developers Console > API Manager > Credentials, create a OAuth Client ID for a Web Application. You will need to provide an authorized redirect URI origin: https://<PROJECT_ID>.appspot.com/oauth2callback.

  • Replace CLIENT_ID and CLIENT_SECRET with these values in your app.yaml

  • Move into the appengine-java11/oauth2 directory and compile the app:

  cd ../oauth2
  mvn package

Deploy to App Engine Standard

mvn clean package appengine:deploy

To view your app, use command:

gcloud app browse

Or navigate to https://<your-project-id>.appspot.com.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.