0.0
No commit activity in last 3 years
No release in over 3 years
OmniAuth Strategy for nk.pl using OAuth2
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 2.8

Runtime

~> 0.4.6
~> 1.0
 Project Readme

nk.pl OAuth2 Strategy for OmniAuth 1.0

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

Installing

Add to your Gemfile:

gem 'omniauth-nk'

Then bundle install.

Usage

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

Auth Hash

Here's an example Auth Hash available in request

{
  :provider => 'nk',
  :uid => 'person.acbdefgh',
  :info => {
    :name => 'Jan Kowalski',
    :email => 'jan@kowalski.pl',
    :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]
      }
    }
  }
}