appengine

command
v1.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

README

This example demonstrates using the auth subpackage to require Google OAuth login before serving a simple page.

Handlers

  • / handled by HelloHandler which greets authenticated users.
  • /goog_login begins the OAuth flow using auth.GoogleLoginHandler.
  • /goog_callback finishes the OAuth flow via auth.GoogleCallbackHandler.

Environment variables

  • GOOGLE_OAUTH_CLIENT_ID and GOOGLE_OAUTH_CLIENT_SECRET – credentials for a Google OAuth client.
  • ADMIN_EMAILS – optional comma-separated list of admin emails.
  • PORT – HTTP port to listen on (default 8080).

Run go run main.go from this directory after setting the variables above.

Documentation

Overview

Package main provides a minimal example server showing how to use the authentication helpers from the common repository. It defines a simple greeting handler and wires up the OAuth login and callback handlers from the auth subpackage.

Environment variables:

  • GOOGLE_OAUTH_CLIENT_ID and GOOGLE_OAUTH_CLIENT_SECRET must be set with credentials for a Google OAuth web client.
  • ADMIN_EMAILS optionally provides a comma separated list of admin accounts allowed to log in.
  • PORT specifies the HTTP port for the server (default 8080).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL