如何从网站获取 Facebook 身份验证令牌

发布于 2024-10-11 14:12:43 字数 577 浏览 6 评论 0原文

我对 Facebook 开发相对较新,并且看过很多有关 Facebook 身份验证的不同信息,但我想知道实现我想要完成的任务的最佳方法是什么。我正在创建一个基于内容的网站,我想将其与 Facebook 集成。每个内容页面上都会有一个 Facebook 图标。当用户单击它时,我想使用 jQuery 打开一个小对话框,该对话框允许用户在其 Facebook 帐户上共享该页面的链接,并可选择输入有关该页面的评论。如果他们尚未通过 Facebook 身份验证,它将显示一个登录表单,然后一旦通过身份验证,就会显示该表单以将链接发布到他们的墙上。

我在任何时候都不想做的是将用户重定向到 Facebook.com 进行身份验证(如果可能的话)。我不知道这是否是正确的方法,但我想在他们不离开网站的情况下获得身份验证令牌,然后存储该令牌,以便他们不必每次都登录 Facebook想分享一个链接。

我实际上只是想在我的网站上建立一个完全集成的身份验证机制,以便我可以将 Facebook 帐户“链接”到我的一个用户帐户并针对 Facebook API 进行编程。

就像我说的,我对 Facebook API 知之甚少,所以我可能采取了错误的方法。关于创建完全集成的用户体验的最佳方法是什么有什么建议吗?

I'm relatively new to Facebook development and I've seen a lot of different information on authentication to Facebook but I'm wondering what the best way to do what I want to accomplish is. I'm creating a content-based website that I want to integrate with Facebook. On each content page will be a Facebook icon. When a user clicks on it, I want to use jQuery to open a small dialog that will allow the user to share a link to that page on their Facebook account and optionally enter a comment about it. If they have not authenticated to Facebook, it would display a login form and then once authenticated, display the form to post a link to their wall.

What I don't want to do at any point is redirect the user to Facebook.com for authentication (if that's possible). I don't know if this is the right way to do it, but I'd like to obtain an authentication token without them leaving the site and then store that token so that they don't have to log in to Facebook every time they want to share a link.

I'm really just trying to have a fully integrated authentication mechanism with my site so that I can sort of "link" a Facebook account to one of my user accounts and program against the Facebook API.

Like I said, I have very little knowledge of the Facebook API so I might be taking the wrong approach. Any suggestions on what the best way to create a fully integrated user experience would be?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

伪装你 2024-10-18 14:12:43

阅读有关 Facebook Connect 的文档页面。它会告诉你如何做你想做的一切。虽然您必须让它将用户重定向到 facebook.com,但它会出现在一个新的弹出窗口中(如果您希望如此)。

Read this documentation page about Facebook Connect. It will tell you how to do everything you seem to want. Though you have to have it redirect the user to facebook.com, but it would be in a new popup window (if you wanted it to be).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文