python - OpenID 认证 : which method to get a unique identifier to use as key?

标签 python google-app-engine openid

使用 OpenID 身份验证,这是正确的 User获取唯一标识符的实例方法,该标识符可用于在 Datastore 上创建用户并将其标识为 key_name?

可用的方法:

nickname() For OpenID users, the nickname is the OpenID identifier.

federated_identity() Returns the user's OpenID identifier.

federated_provider() Returns the URL of the user's OpenID provider.

在用户登录时,我想通过以下方式检索它:

User.get_by_key_name(key_used_to_create_the_user)

最佳答案

您可能希望在您的系统中生成您自己的用户 ID,以便用户可以更改他们的 OpenID 提供者(或者甚至有多个 OpenID 与他们的帐户相关联,许多网站都支持)。但是,如果您出于某种原因确实想将 OpenID 用作唯一 key ,我认为 federated_identity() 就是您想要的(仅阅读文档,我从未使用过该库)。您需要他们的完整 OpenID URL,它保证是唯一的——这包括 URL 的提供者部分和“用户名”部分(可能是“子文件夹”或子域等)。抱歉,我忘记了技术术语……我已经有一段时间没有使用 OpenID 了。

关于python - OpenID 认证 : which method to get a unique identifier to use as key?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3516241/

相关文章:

.net - 使用 OpenID 的 SSO

python - Google App Engine、ReportLab 和 True Type 字体

ruby - Heroku 上的 Google OpenID-OAuth 混合实现

python - 为什么 rank 方法的升序参数不起作用?

python - 使用 matplotlib 的 ax.text 打印变量会打印值列表而不是数字?

php - 无法从 App Engine 连接到 google cloudsql

ajax - 如何向应用引擎中部署的谷歌分析 super 代理发出 CORS 请求?

grails - 如何在 GSP 中使用 openid4java 实现 openID

python - Pandas 矢量化: Compute the fraction of each group that meets a condition

python - 在 Python 中创建 C 函数指针结构