Generic-user-small ramkaka 31 posts

Hey,

How do I check if the session of a user in the database is valid?

u = User.find(1)
u.facebook_session.user.uid throws *Facebooker::Session::SessionExpired: Session key invalid or no longer valid*
But u.facebook_session.expired? returns false
 
Generic-user-small ramkaka 31 posts

should my timezone be set to something specific by the way?

 
Head_small Mike Mangino 140 posts

Unfortunately, you can’t always tell when a session becomes invalid. When you serialize the session key to the users table, you could store the expiration time. That however isn’t always accurate. If the user continues to use your application, the expiration time will change. Also, when a user logs out of Facebook their key is immediately expired. The best option is just to handle session expired exceptions when they occur.

3 posts, 2 voices