I have a webapp on google app engine that checks to see if a user is logged in (through the federated id) with the following code. I just changed domain names and now for some reason it isn’t recognizing any of my current users. This is because the openID changes depending on the domain name which I found through a little testing. Is there any workaround or way to let these users log in?
user = users.get_current_user()
currentregistereduser = None
try:
user_db_qry = User.query(User.theid == user.federated_identity())
user_db_list = user_db_qry.fetch(1)
currentregistereduser = user_db_list[0]
# I go on here to do all of the stuff for a logged in user
#if the user does not exist yet
except IndexError:
logging.error("indexerror" + str(User.theid) + " and " + str(user.federated_identity()))
user_db = User(
name=user.nickname(),
email=user.email(),
theid=user.federated_identity(),
visits = 0,
medals = 0,
prestige = 1,
)
user_db.put()
#they go on to create their profile data here
self.redirect("/profile")
This seems to be a similar problem to the one faced by StackExchange when it implemented OpenID. You can see how they dealt with it here:
https://blog.stackoverflow.com/2010/04/openid-one-year-later/
From that page:
So our cross-site user account matching now works this way:
Match by GUID. This is something we generate and assign during account association, so it’s a perfect fingerprint.
match by OpenID URL. This works for the vast majority of OpenID providers.
match by OpenID provided email address … if you are on our trust whitelist. This works for those rare OpenID providers (currently, only Google GMail) who generate domain-specific identifiers.
You could also try using a OpenID Library. Several are listed here:
http://openid.net/developers/libraries/
Hope this helps.