什么是oauth以及网站是如何实现的

what is oauth and How does Website Implement it

我知道这个问题有点傻,但我想知道 oauth 到底是什么以及它如何与 facebook、twitter 等一起工作

另外,如果我想为我的网站实现它,比如从我的网站按钮创建登录名,我该怎么做

定义

根据维基百科:

OAuth is an open standard to authorization.OAuth provides client applications a 'secure delegated access' to server resources on behalf of a resource owner. It specifies a process for resource owners to authorize third-party access to their server resources without sharing their credentials.

因此,OAuth 通常用作网络冲浪者使用其 Google、Facebook 或 Twitter 帐户登录第三方网站的一种方式。

工作示例

假设您有一个 Gmail 帐户。您决定手动注册 LinkedIn.Adding 您的朋友可能会很粗略和痛苦。你可能会中途受够了。因此,您可能根本不想创建 LinkedIn 帐户。

LinkedIn 想到了一个好主意并编写了一个程序让计算机从您的 Gmail 帐户中获取所有数据。

如果没有 API 来交换此联系人列表,您可能必须将您的电子邮件帐户提供给 LinkedIn,因此这就是 OAuth 负责的地方。如果您的 Gmail 支持 OAuth 协议,那么 LinkedIn 可以要求您授权他们访问您的 GMail 联系人列表。

参考资料:

1)http://en.wikipedia.org/wiki/OAuth

2)https://blog.apigee.com/detail/when_to_use_oauth