热门网站如何让您从 Facebook 等其他网站登录?
How do popular websites allow you to log-in from other websites like Facebook?
他们如何从这些网站获取信息?在用户同意的情况下,是否有一些通用的方式来公开这些信息?他们如何判断您是否已通过外部网页进行身份验证?它是几个不同的 API 吗?
他们使用 Facebook 创建的特殊 Javascript API,我相信它运行在名为 OAUTH 的协议上。完整的细节可以在 Facebook 开发者页面找到:
https://developers.facebook.com/docs/facebook-login/login-flow-for-web/v2.3
一个人登录后,您可以像这样获取他们的信息:
FB.api('/me', function(data) {
console.log(JSON.stringify(data));
});
然后 facebook 将他们的信息作为一个名为 data
的 JSON 对象发回
社交网络使用 OAuth。
引用自维基百科:
OAuth is an open standard for 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.
你可以看看这些:
脸书:https://developers.facebook.com/docs/reference/dialogs/oauth
Google: https://developers.google.com/identity/protocols/OAuth2
您可以在此处获取不同语言的库列表:http://oauth.net/2/
他们如何从这些网站获取信息?在用户同意的情况下,是否有一些通用的方式来公开这些信息?他们如何判断您是否已通过外部网页进行身份验证?它是几个不同的 API 吗?
他们使用 Facebook 创建的特殊 Javascript API,我相信它运行在名为 OAUTH 的协议上。完整的细节可以在 Facebook 开发者页面找到:
https://developers.facebook.com/docs/facebook-login/login-flow-for-web/v2.3
一个人登录后,您可以像这样获取他们的信息:
FB.api('/me', function(data) {
console.log(JSON.stringify(data));
});
然后 facebook 将他们的信息作为一个名为 data
的 JSON 对象发回社交网络使用 OAuth。 引用自维基百科:
OAuth is an open standard for 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.
你可以看看这些:
脸书:https://developers.facebook.com/docs/reference/dialogs/oauth
Google: https://developers.google.com/identity/protocols/OAuth2
您可以在此处获取不同语言的库列表:http://oauth.net/2/