Low commit activity in last 3 years
No release in over a year
CGTrader OAuth2 Strategy for OmniAuth
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.4.13

Runtime

 Project Readme

Omniauth Cgtrader

Cgtrader OAuth2 Strategy for OmniAuth.

Installation

Add to your Gemfile:

gem 'omniauth-cgtrader'

Then bundle install.

Usage

OmniAuth::Strategies::Cgtrader 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 :cgtrader, ENV['CGT_API_ID'], ENV['CGT_API_SECRET']
end

Auth Hash

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

{
  provider: 'cgtrader',
  uid: '1234567',
  info: {
    id: '123',
    email: 'joe@bloggs.com',
    username: 'joe_bloggs',
    is_admin: false,
    avatar_url: 'https://upload.wikimedia.org/wikipedia/commons/8/89/Portrait_Placeholder.png'
  },
}

Devise

See these on how to use this gem with Devise, replacing Google / Facebook with Cgtrader: