Admin areas are just easier with Google App Engine
Sun, 09 October 2016
Before reading on, take note that quite often you need your own system. This isn't a catchall solution, but for basic administrative systems, this is great.
We've all made numerous admin systems. And for most of us, it's something of a chore. Not least because it takes ages to put a decent login system together, but because whenever you want to implement a login, there are just way too many pieces to think about. Registration, login, password reset, verification emails.
It just sucks.
Thankfully, using App Engine, you can easily create authenticated areas based on the ACL already inside your Google Cloud console. Take this snippet of an app.yaml for example:
handlers: - url: /.* script: app_admin.app login: admin
This immediately is interpreted to disallow non-administrative access to any URL's beginning in / - which if you ask me is a an absolute blessing.
Google manage the accounts, Google manage the authentication. It's so simple.
Sure, it feels super weird not having to spend a couple days putting your authentication system together, and maybe it's a bit lazy to use Google's platform for this, but it just works.
And, if you really need access to the user account? Well, they thought of that too:
from google.appengine.api import users
user = users.get_current_user()
if user is None:
# They are not logged in.
email_address = user.email()
user_id = user.user_id()
user_nickname = user.nickname()
You couldn't get any easier than that. It makes creating these applications incredibly simple.