Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to support multi-login on AppEngine

I'm refactoring for a client an app that should support OpenID, Facebook Connect and custom authentication (email+password). Suppose that i have:

class MyUser(db.Model):
    pass
class Item(db.Model):
    owner = db.ReferenceProperty(MyUser)

I was thinking to implement different authentication systems this way:

class OpenIDLogin(db.Model): # key_name is User.federated_identity()? User.user_id()?
    user = db.ReferenceProperty(MyUser)

class FacebookLogin(db.Model): # key_name is Facebook uid
    user = db.ReferenceProperty(MyUser)

class CustomLogin(db.Model): # key_name is the user email
    user = db.ReferenceProperty(MyUser)
    password = db.StringProperty()

Is there a better solution? There is already an answer here but i can't understand if that's the right solution for me. I've already developed an app using the Users API and another one using Facebook Connect in the past, so i know how to deal with the both, the problem is to wire them together. Switching to another framework isn't an option unfortunately.

like image 783
Spear Avatar asked Nov 17 '10 00:11

Spear


People also ask

What type of service model is Google Appengine using?

Google App Engine (GAE) is a platform-as-a-service product that provides web app developers and enterprises with access to Google's scalable hosting and tier 1 internet service.

Why is Google Appengine important?

Google allows you to add your web application code to the platform while managing the infrastructure for you. The engine ensures that your web apps are secure and running and saves them from malware and threats by enabling the firewall.

What is App Engine standard environment?

The App Engine standard environment is based on container instances running on Google's infrastructure. Containers are preconfigured with one of several available runtimes. The standard environment makes it easy to build and deploy an application that runs reliably even under heavy load and with large amounts of data.


1 Answers

I would take a close look at tipfy and its Authentication extension.*

They have implemented a Universal User model that can be used with App Engine's default users API, own auth or third party authentication methods (OpenId, OAuth etc).

Here is the documentation, look for MultiAuthMixin section.

*good programmers write good code; great programmers steal great code

like image 93
systempuntoout Avatar answered Sep 19 '22 08:09

systempuntoout