Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Devise with Sinatra

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.

like image 512
Martin Avatar asked Jan 30 '11 09:01

Martin


2 Answers

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.

like image 96
Bobby Calderwood Avatar answered Oct 29 '22 06:10

Bobby Calderwood


Devise is designed for Rails only. You can't use it with Sinatra.

You can check out:

https://github.com/maxjustus/sinatra-authentication

http://www.gittr.com/index.php/archive/sinatra-basic-authentication-selectively-applied/

https://gist.github.com/243611

like image 45
tjeden Avatar answered Oct 29 '22 05:10

tjeden