Reputation: 26008
A Rails gem titled omniauth-ebay
which is compatible with Sinatra uses the code below to setup itself:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :ebay, "runame", "devid", "appid", "certid", "siteid", "apiurl"
end
I know that omniauth
(omniauth-ebay
based on it) gem is definitely compatible with Sinatra. Note that that's not a eBay or gem specific question, there certainly should be a generic way to setup a middleware in Sinatra.
Well, how do I change the code above to make it work with Sinatra?
Upvotes: 1
Views: 98
Reputation: 35308
You just need to understand what Rails is hiding from you. Rack middlewares are actually mounted directly inside of Rack.
In your config.ru file:
use OmniAuth::Builder do
provider :ebay, "runame", "devid", "appid", "certid", "siteid", "apiurl"
end
The config.ru is loaded by Rack, so anything Rack-specific should go in there, unless you have some sort of system to put it elsewhere. I suspect Sinatra probably allows you to call #use
from inside your Sinatra application, but still, config.ru will work in all cases.
Upvotes: 2