Custom authentication in Google App Engine

Does anyone know or know of somewhere I can learn how to create a custom authentication process using Python and Google App Engine?

I don't want to use Google accounts for authentication and want to be able to create my own users.

If not specifically for Google App Engine, any resource on how to implement authentication using Python and Django?

Answers


Well django 1.0 was updated today on Google AppEngine. But you can make user authentication like anything else you just can't really use sessions because it is so massive.

There is a session utility in http://gaeutilities.appspot.com/

http://gaeutilities.appspot.com/session

http://code.google.com/p/gaeutilities/

Or,

You have to create your own user tables and hash or encrypt passwords, then probably create a token system that mimics session with just a token hash or uuid cookie (sessions are just cookies anyways).

I have implemented a few with just basic google.webapp request and response headers. I typically use uuids for primary keys as the user id, then encrypt the user password and have their email for resets.

If you want to authorize users for external access to data you could look at OAuth for application access.

If you just want to store data by an id and it is more consumer facing, maybe just use openid like stackoverflow and then attach profile data to that identifier like django profiles (http://code.google.com/p/openid-selector/).

django 1.0 just came out today on GAE but I think the same problems exist, no sessions, you have to really create your own that store session data.


This is a pretty out-of-the-box solution, and works pretty well: http://code.scotchmedia.com/engineauth/docs/index.html

It has built-in support for Facebook, Google+, Twitter, LinkedIn, GitHub and OpenId (via Google App Engine).

you just have to redirect the user to /auth/facebook or /auth/google and so on (this url is customizable).

It also implements two classes: User and UserProfile, every User is a unique account in your app and may relate to one or more UserProfiles -- which one is a login strategy that the unique User has to login into your app (if it's unclear, it's because my English is very bad, the docs explain better).

P.S.: The documentation is not very complete, but the code is pretty simple, short and self-explanatory. Also, there is a discussion here in which the author provides various answers to questions of confused and beggining users.


The OpenID consumer (part of the excellent "app engine samples" open source project) currently works (despite the warnings in its README, which is old) and would let you use OpenID for your users' logins.

django's auth is also usable, via e.g. this project (at least the users part, not necessarily groups and permissions though they might get them working any time).


I saw that this pops up in google, every time you search "Custom login in app engine" so I decided to give an answer that has been serving me. Here is sample application https://github.com/fredrikbonander/Webapp2-Sample-Applications

This uses

  1. webapp2 (already in GAE 1.6.2)
  2. Jinja2 (already in GAE 1.6.2)

Webapp2 seems to be the best bet for GAE (built on top of webapp hence future proof) so authentication using framework natively supported by GAE is a good idea. There are many other frameworks but a lot of hacking has to be done on the users part to make them work. For people who want to build a "Stable" site, such hack work is extremely undesirable.

I also realize that SQL support for GAE is there now and django will be supported natively. We all know django has built in user authentication system. Although, I think, especially in the cloud world NoSQL is the future. I am sure there will be a framework as good as django in the future for NoSQL. But thats me, your requirement might demand something else.


Here is an excellent and relatively recent (Jan 2013) blog post titled User authentication with webapp2 on Google App Engine, and related GitHub repo: abahgat/webapp2-user-accounts.


Have a look app-engine-patch for Django (your preferred framework I assume from your question). It offers authentication on gae.

Alternatively, take a look at web2py. It's a Python-based framework that works on GAE and Relational databases. It's built-in Auth object provides for users, groups and permissions.

It doesn't give unbridled access to BigTable though, instead offering a subset of relational functionality (BigTable doesn't support Joins for example and web2py doesn't [yet] support BigTable models).

Support for BigTable is being discussed by both Web2py and Django communities.


I googled around for a custom authenication system for app engine for a while. I eventually settled for running flask on app engine. I used this boilerplate for running flask on app engine https://github.com/kamalgill/flask-appengine-template/ and this flask auth extension http://pypi.python.org/pypi/Flask-Auth/ which comes with plug and play google app engine support. I think flask also has a very nice oAuth library so eventually adding facebook and twitter logins will be easy


In addition to all the other great answers, I would also add that Facebook, Twitter, and github all offer OAuth mechanisms that you can utilize as turn-key authentication support for your app.


Take a look at this project I am working on with coto: https://github.com/coto/gae-boilerplate It includes a fully featured custom authentication system and much more.


Another option is the Beaker module. The AES encryption for client side sessions is nice.


Need Your Help

How to view annotation of java classfile via command line?

java class command-line jar annotations

Is there a command line tool, preferrably in the JDK, that either prints all annotations in a classfile or takes a specific annotation as argument to print?

Web based large scale graph drawing library

javascript canvas cluster-analysis webgl graph-visualization

Is there any good javascript library for drawing graphs in a webpage? I want a modern HTML5 library that preferably uses canvas and/or webgl. I have found a couple of good web libraries while resea...