ngingd
ngingd

Reputation: 43

How to get the the User ID from an email in GAE

I'm working on a small app that will allow the user to login to the App, allow the app OAuth access to a service, then interact with the service using the app via email.

I've successfully enabled Oauth using gdata and gdata.gauth and can store/recover the Oauth token and user_id easily when the user is logged in.

However, when receiving an email, I try to get the user_id by creating a users.User(email="[email protected]") but end up getting a None value for the user_id.

ie:

when logged in:

current_user = users.get_current_user()
current_user.user_id() #this is a valid id when the user is logged in

when receiving an email (using the mail handler):

current_user = users.User(email="[email protected]")
current_user.user_id() #this returns None

Any hints on how to make this work?

Upvotes: 0

Views: 180

Answers (1)

Bill Lynch
Bill Lynch

Reputation: 81936

Reading http://code.google.com/appengine/docs/python/users/userclass.html#User

Under the method call user_id, it is noted that if you create the User object yourself, the user_id field will return None.

Upvotes: 1

Related Questions