Skip to content

yuanping/omniauth-kanbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

omniauth-kanbox

Unofficial OmniAuth strategy for Kanbox.

Installation

Add this line to your application's Gemfile:

gem 'omniauth-kanbox'

And then execute:

$ bundle

Or install it yourself as:

$ gem install omniauth-kanbox

Usage

OmniAuth::Strategies::Kanbox is simply a Rack middleware. Read the OmniAuth docs for detailed instructions: https://github.com/intridea/omniauth.

Here's a quick example, adding the middleware to a Rails app in config/initializers/omniauth.rb:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :kanbox, ENV['KANBOX_KEY'], ENV['KANBOX_SECRET']
end

Auth Hash

Here's an example Auth Hash available in request.env['omniauth.auth']:

{
  :provider => 'kanbox',
  :uid => 'user email',
  :info => {
    :email => 'yp.xjgz@gmail.com',
    :name => 'yp.xjgz@gmail.com',
    :phone => '18612553650',
    ::description => 'spaceUsed:200/20000'
  },
  :credentials => {
    :expires => false,
    :token => 'ABCDEF...', # OAuth 2.0 access_token, which you may wish to store
    :refresh_token => 'decfa',
    :expires_at => 1321747205 # when the access token expires (it always will)
  },
  :extra => {
    :raw_info => {
      :status => 'ok',
      :email => 'yp.xjgz@gmail.com',
      :phone => '18612553650',
      :spaceQuota => '200',
      :spaceUsed => '20000',
      :emailIsActive => 1,
      :phoneIsActive => 0
    }
  }
}

The precise information available may depend on the permissions which you request.

About

Unofficial OmniAuth strategy for Kanbox(酷盘).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages