{"id":2168,"date":"2015-09-11T15:51:09","date_gmt":"2015-09-11T10:21:09","guid":{"rendered":"http:\/\/codetheory.in\/?p=2168"},"modified":"2015-09-23T21:43:51","modified_gmt":"2015-09-23T16:13:51","slug":"rails-devise-omniauth-sso","status":"publish","type":"post","link":"https:\/\/codetheory.in\/rails-devise-omniauth-sso\/","title":{"rendered":"Single Sign On (SSO) for Multiple Applications with Devise, OmniAuth and Custom OAuth2 Implementation in Rails"},"content":{"rendered":"

Recently I had to implement Single Sign On<\/a> (SSO) for one of the Rails app I’d been working on. Since Devise is already fairly popular to integrate an authentication system in Rails app, I was more inclined towards using it to achieve SSO. So essentially what was required is a single user manager app that can act as a Provider<\/strong> (OAuth2 ?) and different applications (or Clients<\/strong>) that can authenticate themselves using this same user manager. An important part of SSO is, once you sign in to one of the client, you should automatically be authorized to access all the other clients (their login-protected sections\/modules). Similarly, logging out from one service should log out from all other services.<\/p>\n

<\/p>\n

To accomplish this, I found an excellent article by JoshSoftware<\/a> that solved my problem. Although I’d to change a lot of the code to make it Rails 4 compatible (from Rails 3). I’ve even uploaded the source code on Github:<\/p>\n