Implement multiple sign in with Rails and Devise -


how mimic google's multiple sign-in in rails app? essentially, need allow user sign in 2 or more different unlinked accounts , able switch between them without signing out , in each time. user have authenticate username , password once each account wishes use, subsequently not have login accounts again until session expiration.

i saw post guesses @ google's implementation, hints best way approach in rails 3.1. i'm using devise cas plugin. assume need override current_user method pick correct account, i'm not sure else do.

or maybe can use scopes this? issue though need arbitrary number of accounts logged in simultaneously.

devise not default , have implement yourself. believe best approach solve problem maintain signed cookie (cookies.signed) ids of users signed in.

basically, every time user signs in, add id cookie if isn't there yet (there warden callback every time user signs in).

now have ids, can show signed in names in corner google. when user clicks in 1 of names in corner, pass id server, check if id in signed cookie , switch new user using sign_in method in controller.


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -