Supports the OAuth 2.0 server-side authentication, and OAuth user data endpoint. To get application key/secret please go to http://developers.nk.pl
Add to your Gemfile
:
gem 'omniauth-nk'
Then bundle install
.
Put into your config/initializers/omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do
provider :nk, ENV['NK_KEY'], ENV['NK_SECRET']
end
OmniAuth.config.on_failure do |env|
[302, {'Location' => "#{env['SCRIPT_NAME']}#{OmniAuth.config.path_prefix}/failure?message=#{env['omniauth.error.type']}", 'Content-Type'=> 'text/html'}, []]
end
Get own application key/secret from http://developers.nk.pl
Here's an example Auth Hash available in request
{
:provider => 'nk',
:uid => 'person.acbdefgh',
:info => {
:name => 'Jan Kowalski',
:email => '[email protected]',
:age => 33,
:gender => 'male'
:location => 'Wrocław',
:image => 'http://photos.nasza-klasa.pl/125/10/thumb/6646b702e7.jpeg',
},
:credentials => {
:token => 'ABCDEF...',
:expires_at => 1321747205,
:expires => true
},
:extra => {
:raw_info => {
:entry => {
[see http://developers.nk.pl/wiki/Rest_Service_Profile_Information]
}
}
}
}