Monday, October 13, 2008

Authentication for GWT based applications on Google App Engine

there is a way to use Java together with Google App Engine: GWT together with python-gwt-rpc. Although python-gwt-rpc has it's own means to allow authentication, there is also an easier way: just check in the Python code whether the user is authenticated and generate a login page or a page for hosting your GWT application.

...
from
google.appengine.api import users

class MyHandler(webapp.RequestHandler):
def get(self):
user
= users.get_current_user()
if user is None:
self.response.out.write('''Login page here...''')
else:
self.response.out.write('''GWT hosting page here...''')

here is how it looks in a live application