user308808
user308808

Reputation:

How does facebook single sign-on work under the hood?

I am using the new javascript sdk and I am developing locally (ie. no hosted server).

I was successfully able to get the access token which the js api stores in a cookie for localhost domain. However what I don't understand is:

Can someone demystify what is happening under the hood here?

Upvotes: 4

Views: 1869

Answers (1)

daaku
daaku

Reputation: 2807

FB JS is able to set cookies on localhost because you're including the FB JS SDK on your domain via a <script> tag there by giving them access to your cookies (much the same way Google Analytics writes cookies for your domain).

OAuth 2.0 involves a redirect to your website, there's really no other way for Facebook to return the code necessary for your app to retrieve the access_token.

Upvotes: 2

Related Questions