让 authlogic_facebook_connect 在数据库中创建用户

发布于 2024-08-20 16:48:37 字数 541 浏览 3 评论 0原文

我在我的网站上使用 Authlogic Facebook Connect 插件。经过一番努力后,我可以使用 FBConnect 登录,可以从 FBSession 获取信息,例如用户名,并且可以注销。但是,插件网站上的自述文件似乎表明,遵循这五个步骤将导致 FB UID 保存在本地数据库中(大概是针对它将创建的用户),但文档或代码中没有任何内容表明如何保存这确实会发生。我想要的是,当用户使用 FBConnect 登录时,我会为他们匹配或创建一个新用户。从那时起,我可以在我的控制器和视图中正常使用 current_user (这样 current_user.id 是他们的本地 id,而不是他们的 facebook id,因为我想要多种形式的身份验证),但如果我想要该用户的 facebook 内容,我可以可以轻松访问它,也许可以使用 current_user.fb_user 之类的东西。

有人能够做到这一点吗?如果是这样,怎么办?

谢谢。

I'm using the Authlogic Facebook Connect plugin on my site. After a bit of a struggle I can sign in with FBConnect, I can get stuff from the FBSession, like the users name, and I can logout. But, the README on the plugin site seems to suggest that following the five steps will result in the FB UID being saved in your local database (presumably against a user it will have created), but there's nothing in the docs or code that indicates how this will actually happen. What I want is that when a user signs in using FBConnect, I either match or create a new user for them. From then on I can use current_user in my controllers and views as normal (so that current_user.id is their local id, not their facebook id, since I want multiple forms of authentication), but if I want facebook stuff for that user I can access it easily, maybe with something like current_user.fb_user.

Has anyone been able to do this? If so, how?

Thanks.

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

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

发布评论

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

评论(1

清醇 2024-08-27 16:48:37

这正是 Authlogic 想要做的!当我安装 facebook 插件时,文档中缺少的一件事是需要在用户表中添加 facebook_session_key 列:

add_column :users, :facebook_session_key, :string

您添加了此列吗?

This is precisely what Authlogic is suppose to do! One thing that was missing from the doc when I installed the facebook plugin was the need to add a facebook_session_key column in the users table :

add_column :users, :facebook_session_key, :string

Did you add this column?

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