Sha256: 2b004a04fce0d10061d0aad2444ecc3db78bc7126e61847058e823bc05fa639a

Contents?: true

Size: 671 Bytes

Versions: 2

Compression:

Stored size: 671 Bytes

Contents

require 'bundler'
require 'sinatra'
require 'omniauth-mendeley'

use Rack::Session::Cookie

# to register a Mendeley app sign up at http://mendeley.com/,
# then login with given credentials at http://dev.mendeley.com

MENDELEY_CONSUMER_KEY = 'your_app_key'
MENDELEY_CONSUMER_SECRET = 'your_app_secret'

use OmniAuth::Builder do
  provider :mendeley, MENDELEY_CONSUMER_KEY, MENDELEY_CONSUMER_SECRET
end

class App < Sinatra::Base
  get '/' do
    "<a href='/auth/mendeley'>Sign in via Mendeley</a>"
  end

  get '/auth/:provider/callback' do
    content_type 'text/plain'
    info = request.env['omniauth.auth'].to_hash
    MultiJson.dump(info).to_s
  end
end

run App.new

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
omniauth-mendeley_oauth2-1.0.1 example/config.ru
omniauth-mendeley_oauth2-1.0 example/config.ru