Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to turn a Rails app with Devise into an OAuth provider?

I have a Rails application with admin accounts using Devise for authentication. I am creating a second application and would like to authenticate using the first application instead of duplicating admin accounts in the second application. So my idea is to turn the first application into an OAuth provider so that the second app can simply act as an OAuth client using something like OmniAuth. Have you done this before? Is there a plugin which adds the ability to Devise to be able to act as an OAuth provider? What do I need to change/add in order to turn the app into an OAuth provider?

like image 368
Andrew Avatar asked Sep 16 '14 20:09

Andrew


1 Answers

Use Doorkeeper gem. Its easy to introduce OAuth 2 provider functionality to your application. It can be also integrated with Devise.

Doorkeeper also provides a configuration option to auto-approve and skip the authorization step. This is useful when working with a set of trusted applications, so that you don't confuse your users by requiring them to "authorize" your company's trusted app.

# in config/initializers/doorkeeper.rb
Doorkeeper.configure do
  # ...other config options...

  skip_authorization do
    true
  end

end
like image 123
mohameddiaa27 Avatar answered Sep 22 '22 13:09

mohameddiaa27