Devise with Sinatra

Martin picture Martin · Jan 30, 2011 · Viewed 12.8k times · Source

Does anyone had installed Devise gem with Sinatra?

Devise is based on Warden and so it should work on Sinatra, I couldn't find any related info about how to implement it.

Answer

Bobby Calderwood picture Bobby Calderwood · Feb 4, 2011

Devise is really just a Rails-centric wrapper with nice helpers for warden, which is the underlying Rack authentication framework. So if you're using Sinatra in conjunction with Rails, you can use Devise in your Rails app, and use warden directly in your Sinatra app, and they will see the same user session data.

So no, you can't use Devise directly within your Sinatra app, but if you're building a modular app with some pieces in Rails, and other pieces in Sinatra, you can use Devise/Warden among the components.