How can I determine a user_id based on an email address in App Engine?

寵の児 提交于 2019-11-27 19:09:58

The current workaround is to create a User object, store it to the datastore, and fetch it again. If the email corresponds to a valid Google account, the User object in the returned entity will have its user_id field populated.

To make the proposed solution work with NDB, just add use_cache=False, use_memcache=False to the get method. That is: obj = key.get(use_cache=False, use_memcache=False) This guarantees getting the entity from the Datastore with the user_id param populated (only if this is a valid Google account).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!