No release in over 3 years
Low commit activity in last 3 years
Offical Jinshuju OAuth2 strategy for OmniAuth
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 10.0
~> 3.4

Runtime

 Project Readme

OmniAuth::Strategies::Jinshuju

OAuth2 Strategy for Jinshuju

Installation

Add this line to your application's Gemfile:

gem 'omniauth-jinshuju'

Or, if you want to use the github source:

gem 'omniauth-jinshuju', git: 'git@github.com:jinshuju/omniauth-jinshuju.git'

And then execute:

$ bundle

Usage

You need client_id & client_secret.

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

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :jinshuju, ENV["JINSHUJU_CLIENT_ID"], ENV["JINSHUJU_CLIENT_SECRET"]
end

Or If your are using devise add follwing in config/initializers/devise.rb

config.omniauth :jinshuju, ENV["JINSHUJU_CLIENT_ID"], ENV["JINSHUJU_CLIENT_SECRET"]

Then add the following to 'config/routes.rb' so the callback routes are defined.

devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }

Make sure your model is omniauthable. Generally this is "/app/models/user.rb"

Sample Auth Hash

{
  "provider"=>"jinshuju",
  "uid"=>"123456",
  "info"=> {
    "name"=>"xiaojin",
    "email"=>"user@email.com",
  },
  "extra"=> {
    "raw_info"=> {
      "type"=>"user",
      "id"=>"123456",
      "name"=>"xiaojin",
      "login"=>"user@email.com"
    }
  }
}

Contributing

Bug reports and pull requests are welcome. This project is intended to be a safe, welcoming space for collaboration.

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes along with test cases (git commit -am 'Add some feature')
  4. If possible squash your commits to one commit if they all belong to same feature.
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request.

License

The gem is available as open source under the terms of the MIT License.