开发者

setting Facebook Connect cookie expiration when using Rails/OmniAuth

I have a Rails 3 app that authe开发者_开发技巧nticates users using (v0.2.6). In OmniAuth, I am only using Facebook as the authentication provider.

My omniauth.rb file looks like this...

Rails.application.config.middleware.use OmniAuth::Builder do
    key = 'a6h456kh78gnjh4kjh7'      # not my real API key
    secret = 'kjh45kj56odf987yjkh3'  # not my real secret either
    provider :facebook, key, secret
end

This works, but the Facebook cookie expiration seems to be set as "session". Is there a way to have the Facebook cookie expiration last for a longer period of time? Ideally I'd like to set it for a year.


Set a permanent cookie using:

cookies.permanent.signed[:user_id] = user.id
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜