Skip to content

sgk/google-auth-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google Auth Demo

Just a simple Google App Engine application to demonstrate the use of the GAE users API to authenticate users against Google Accounts. Such Google Accounts include users in non-Google domain managed by Google Apps.

The core of the demonstration is only 8 lines in "main.py". See "login_required" decorator function. Other directories and files are from Flask, Werkzeug, Jinja2 and Bootstrap, which are not essential to this demonstration purpose.

I don't claim any copyright licenses and terms for my files: "main.py", "app.py", "app.yaml", "shell" and "base.html". Please feel free to copy or use these files.

You may want to restrict page accesses to users in a specific Google Apps domain. This is easy by checking email address of login user.

  user = users.get_current_user()
  username, domain = user.email().split('@', 1)
  if domain not in authorized_domains:
    return redirect(users.create_login_url())

See http://code.google.com/intl/en/appengine/docs/python/users/ for the detail of the GAE Users API.

//sgk

About

Demo to use Google Account authentication on GAE

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published