Where to find the Facebook cookie?

前端 未结 1 1662
灰色年华
灰色年华 2021-01-21 07:00

I\'m kinda new to this so bear with me. I\'ve installed a \"Login with Facebook\" button via the Javascript SDK, which works fine. I\'ve also set up the PHP code (facebook.php)

相关标签:
1条回答
  • 2021-01-21 07:49

    I happen to have a blog post and some previous answers that may be of use to you as reference points.

    Have you registered your site on Facebook as an "application"? If not, you'll need to do that. The cookie which Facebook sets that allows your site to access a user's information (once they've agreed to give your "application" access) uses a combination of your application's ID and "secret" (a long alphanumeric string that you must not share, or other applications would be able to impersonate yours) to set an encrypted value with the user's ID and an authentication token unique to the user and your application (representing the permission they've given you to their data).

    The cookie is posted to your site alongside requests like any other cookie. You'd use your application's secret to decrypt it and extract the user's ID and authentication token, which you would then use to access data via Facebook's graph API.

    0 讨论(0)
提交回复
热议问题