0.0
Low commit activity in last 3 years
A long-lived project that still receives updates
OmniAuth strategy for Wonde
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 3.0
~> 13.0
~> 1.54

Runtime

 Project Readme

OmniAuth::Wonde

Gem Version Ruby Codacy Badge

Strategy to authenticate with Wonde via OAuth2 in OmniAuth.

Installation

Add this line to your application's Gemfile:

gem 'omniauth-wonde'

And then execute:

$ bundle

Or install it yourself as:

$ gem install omniauth-wonde

Usage

For example, adding middleware to a Rails app in config/initializers/omniauth.rb:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :wonde, ENV['WONDE_CLIENT_ID'], ENV['WONDE_CLIENT_SECRET']
end

The OmniAuth Wonde URL is then accessible at: /auth/wonde

Devise

Specify as a provider in config/initializers/devise.rb:

  config.omniauth :wonde, ENV['WONDE_CLIENT_ID'], ENV['WONDE_CLIENT_SECRET']

Configuration

Additional configuration options can be provided as keyword arguments.

  • redirect_uri: specify a custom redirect URI

Auth hash

Example of authentication hash available in request.env['omniauth.auth']:

{
  "provider" => "wonde",
  "uid" => "A1000000000",
  "info" => {
    "name" => "John Schmidt",
    "first_name" => "John",
    "last_name" => "Schmidt",
    "middle_names" => "Jacob Jingleheimer",
    "school_name" => "Acorn Primary School",
    "school_id" => "A1000000001",
    "person_type" => "student",
    "person_id" => "A100000002",
    "upi" => "0d50e37c226a4c189404f2d0747f5839"
  },
  "credentials" => {
    "token" => "[TOKEN]",
    "refresh_token" => "[REFRESH_TOKEN]",
    "expires_at" => 1496120719,
    "expires" => true
  },
  "extra" => {
    "raw_info" => {
      "Me" => {
        "id" => "A1000000000",
        "Person" => {
          "id" => "A100000002",
          "type" => "student",
          "forename" => "John",
          "middle_names" => "Jacob Jingleheimer",
          "surname" => "Schmidt",
          "upi" => "0d50e37c226a4c189404f2d0747f5839",
          "School" => {
            "id" => "A1000000001",
            "name" => "Acorn Primary School"
          }
        }
      }
    }
  }
}

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/tcrouch/omniauth-wonde.

License

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