KthProg
KthProg

Reputation: 2117

How do popular websites allow you to log-in from other websites like Facebook?

And how do they get information from these sites? Is there some common way of exposing this information with the users consent? How can they tell if you've authenticated with the external webpage? Is it several different APIs?

Upvotes: 2

Views: 52

Answers (2)

Abdel Raoof Olakara
Abdel Raoof Olakara

Reputation: 19353

Social Networks makes use of OAuth. Quoting from wikipedia:

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.

You can have a look at these:

Facebook : https://developers.facebook.com/docs/reference/dialogs/oauth

Google: https://developers.google.com/identity/protocols/OAuth2

You can get list of libraries for different languages here: http://oauth.net/2/

Upvotes: 2

user3413723
user3413723

Reputation: 12263

They use a special Javascript API that Facebook has created, which I believe runs on a protocol called OAUTH. The complete details can be found at the Facebook developer page:

https://developers.facebook.com/docs/facebook-login/login-flow-for-web/v2.3

Once a person is logged in, you can get their information like this:

FB.api('/me', function(data) {
    console.log(JSON.stringify(data));
});

Then facebook sends back their information as a JSON object called data

Upvotes: 1

Related Questions