OmniAuth Bigcommerce Strategy
Switch branches/tags
Clone or download
splittingred Merge pull request #17 from bigcommerce/PEN-540
PEN-540: Upgrade omniauth-bigcommerce dependencies
Latest commit 27eb71f Dec 20, 2017

README.md

OmniAuth Bigcommerce Strategy

Build Status

This gem provides a dead simple way to authenticate to Bigcommerce using OmniAuth.

Installation

Add to your application's Gemfile:

gem 'omniauth-bigcommerce'

Usage

First, you will need to register an application.

Create a config/initializers/omniauth.rb initializer:

use OmniAuth::Builder do
  provider :bigcommerce, ENV['BC_CLIENT_ID'], ENV['BC_CLIENT_SECRET'], 'users_basic_information store_v2_settings store_v2_orders'
end

You may also overwrite default config options:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :bigcommerce, ENV['BC_CLIENT_ID'], ENV['BC_CLIENT_SECRET'],
           {
             scope: "users_basic_information store_v2_products store_v2_information",
             client_options: {
               site: 'https://login.bigcommerce.com'
             }
           }
end

See the Omniauth Wiki for more information.

Environment Variables

The gem will look for the bigcommerce oauth provider URL in the BC_AUTH_SERVICE environment variable. It defaults to https://login.bigcommerce.com if the env variable is not defined.

Auth Hash Schema

The following information is provided back to you for this provider:

{
  uid: '12345',
  info: {
    name: 'Philip Muir',
    email: 'philip.muir@example.com'
  },
  credentials: {
    token: 'xyz123abc'
  },
  extra: {
    raw_info: {},
    scopes: 'requested_scopes store_v2_settings'
    context: 'store/xyz123'
  }
}

Contributing

Fork & submit a pull request.