开发者

setting Facebook Connect cookie expiration when using Rails/OmniAuth

开发者 https://www.devze.com 2023-03-14 22:21 出处:网络
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.

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

精彩评论

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

关注公众号