使用Facebook身份验证的Sinatra中的会话

问题描述:

我是红宝石&的新手. Sinatra和我有一个基本问题:

I'm very new to ruby & Sinatra and I have a basic question:

我要构建的应用程序将使用Facebook,因为它是验证用户身份的唯一方法.我想存储一个本地用户表,该表将仅包含facebook uid以及一些用户首选项.我看过几个gem,它们使我可以通过facebook API进行身份验证,但是我不确定一旦确定用户有效后如何在应用程序中控制会话.我一直在使用 koala 宝石与Facebook聊天,我也看到了

The app I'm trying to build will use Facebook as it's sole method of authenticating users into the app. I want to store a local users table which will contain only the facebook uid along with some user preferences. I have looked at a couple of gems which allow me to authenticate against the facebook API, however I am unsure how to control sessions within my application once I have established the user is valid. I have been using the koala gem for talking to facebook, and I have also seen the sinatra-session gem for running the session side of things.

在用户使用其Facebook帐户登录后,有人可以向我指出如何管理会话的正确方向吗?

Can someone point me in the right direction as to how I can manage my sessions once a user has logged in using their facebook account?

我编写了一个具有此功能的示例sinatra应用程序,并使用了sinatra的内置会话.看看这里,也许这对您有帮助: https://github.com/benben/simple-ruby -facebook-example

I wrote an example sinatra app with this functionality and used the built-in sessions from sinatra. look here, maybe this helps you: https://github.com/benben/simple-ruby-facebook-example