Disallowing multiple login by same user using different browsers


I need to create an app where one user cannot login using multiple browsers. As soon as he does, the previous one logs out.

I have a user table with a field named "current_sign_in_token’ to store the session key generated by one login. But I am not able to retrieve the session key. Actually I don’t know exactly how to do it. Have been following several posts but in vain.

Following is my initializers/session_store.rb file

Contactapp::Application.config.session_store :cookie_store,{ :key => ‘_contactapp_session’, :secret => ‘[kjhafdhbcrekjbwrewhbvwbvlwruhfwlkevjnwlghbwljtvhblwevblswetbvlwrnvjnsklejvni45uhvgiwlu758t75fblwbcw…]’, :expire_after => 5.minutes}

I am trying to retrieve request.session_options[:id] in my controller but it doesn’t returns any value. But it does returns values when I use it in a view.

The value Rails.application.config.session_options[:key] doesn’t seems to satisfy what I need to do as it just returns the values ‘_contactapp_session’.

What shall I do next. Am stuck.