This is the unofficial OmniAuth strategy for authenticating to Zotero. To use it, you'll need to sign up for an OAuth Client Key and Secret on the Zotero Applications Page.
You can then use the API key provided by this strategy to authenticate against and use the Zotero Server API.
Heavily inspired by Logan Lowell's OmniAuth-Mendeley gem.
Add this line to your application's Gemfile:
gem 'omniauth-zotero'
And then execute:
$ bundle
Or install it yourself as:
$ gem install omniauth-zotero
First, use the OmniAuth Zotero middleware:
# For Rack apps, in your config.ru
use OmniAuth::Builder do
provider :zotero, ENV['ZOTERO_KEY'], ENV['ZOTERO_SECRET']
end
# For Rails apps, in config/initializers/omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do
provider :zotero, ENV['ZOTERO_KEY'], ENV['ZOTERO_SECRET']
end
Then, read the OmniAuth documentation on Integrating OmniAuth Into Your Application.
In the example/
directory, run the provided Rack application for a demo:
$ cd example/
$ bundle
$ ZOTERO_KEY=abc123 ZOTERO_SECRET=def456 rackup
Then visit localhost:9292 to try it out.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
See accompanying LICENSE file.