我正在尝试了解 OpenID 和 OAuth。
据我了解,OpenID 仅表示您是 OpenID 提供商的用户。 因此,如果我使用 OpenID 登录某个站点,它只会返回“是的,此人是 X 站点的用户。”
如果我想检索用户的电子邮件地址,我还需要授权,这就是 OAuth 的用武之地。
话虽如此,这是否意味着如果 OpenID 用户名是电子邮件地址,那么没有 OAuth 就无法检索该信息?
最佳答案
这是一篇关于 OpenID vs OAuth 的好帖子。
From what I understand, OpenID only says that you are a user of the OpenID provider. So if I log into a site using an OpenID, all it will return is "yes, this person is a user of X site."
这取决于您使用谁作为 OpenID 提供商以及他们是否支持 Attribute Exchange - 允许中继方询问有关用户的其他属性(例如他们的电子邮件)。这是 SO question asking关于 Google/Yahoo 支持的属性交换值。
All that being said, does this imply that if an OpenID username is an email address, there is no way to retrieve that information without OAuth as well?
同样,这取决于您使用 OpenID/Oauth 的人(也可能取决于每个协议(protocol)的版本)。 OpenID 提供商不一定必须使用电子邮件作为用户名,并且提供商可以在其 OpenID 和 OAuth 实现中同时提供电子邮件。例如,Google 允许检索 email address via OAuth2除了在 OpenID 属性交换中提供电子邮件之外。
关于oauth - 仅使用 OpenID 可以获得用户电子邮件吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18602277/