Code Monkey home page Code Monkey logo

omniauth-bigcommerce's Introduction

OmniAuth Bigcommerce Strategy

Build Status

This gem provides a 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 response format is provided back to you for this provider:

{
  uid: '12345',
  info: {
    name: 'John Doe',
    email: '[email protected]'
  },
  credentials: {
    token: 'xyz123abc'
  },
  extra: {
    raw_info: {},
    scopes: 'requested_scopes store_v2_settings'
    context: 'store/xyz123',
    account_uuid: 'fooBar'
  }
}

Contributing

Fork & submit a pull request.

omniauth-bigcommerce's People

Contributors

carsonreinke avatar exedog avatar j05h avatar mattolson avatar philipmuir avatar sgerrand avatar splittingred avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

omniauth-bigcommerce's Issues

Store Hash

cannot seem to find the store hash in my response. Context comes in as "".

This is my omniauth.rb

Rails.application.config.middleware.use OmniAuth::Builder do

  provider :bigcommerce, ENV['BC_ID'], ENV['BC_SECRET'], scope: "store_v2_orders"  
           
end

In my app settings. I only have the Orders permission set to modify.

request.env['omniauth.auth'] is always nil in callback

I've read through the documentation and followed set up from a couple of different sources but I can never seem to get the Auth hash back in the callback url.

I'm using Rails 4.2.10

I have a draft application with the temporary callback url set as:
https://43181125.ngrok.io/auth/bigcommerce/callback

I have config/initializers/omniauth.rb set up as:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :bigcommerce, ENV['BC_CLIENT_ID'], ENV['BC_CLIENT_SECRET']
end

right now the omniauths_controller.rb just has the callback action

  def callback
    @auth = request.env['omniauth.auth']
    render 'bigcommerce/index', status: 200, layout: nil
  end

The params being passed into the action from my draft app are as follows:

{"code"=>"{some code}",
 "context"=>"{store context}",
 "scope"=>"store_v2_customers_login store_v2_default store_v2_information_read_only",
 "name"=>"bigcommerce"}

Am I possibly missing something?

Thank you,
Ben

Omniauth OAuth redirect_uri_mismatch when AWS https URI is used

I have developed a bigcommerce application. My draft application working fine with ngRok and Heroku but when I am adding the AWS redirect URI it rendering "mismatch redirect_URI error". I have debugged the app and found the "Protocol" issue. My redict_URI is HTTPS but in callback getting HTTP please help me to resolve this error.

Thank You!

Redirect URI added in application : https://bplugin.giftpal.in
Callback URI : http://bplugin.giftpal.in

is this production ready?

hi,

I want to create bigcommerce connected application using API.
I have developer account but there is no documentation about omniauth authentication.

Is this gem ready to use with bigcommerce application?
When it will be ready?

Thank you for answers

Edit:
I found some information about integrated apps here.
I cannot find any option to create such application on my developer account/dashboard.

Oauth2 v2 is incompatible and Oauth2 dependency is not bounded to <2.0.0

Version 2.x of the oauth2 gem is incompatible - using it will result in "invalid client id" errors on attempting a BC store install.

Since the oauth2 version for this gem isn't limited to less than 2.0, any new installs or bundle updates will automatically pull in the absolute latest version causing project breakage.

While upgrading this gem to be compatible with oauth2 v2 would be a nice-to-have, at a minimum the oauth2 dependency should be limited to 1.x.

EDIT: Workaround is to explicitly include oauth2 in your gemfile with version 1.x

PSA regarding requesting the access_token

Just writing this down in case someone else runs into it.
Using this gem, you do not need to carry out the additional step of requesting the access_token that's outline in the official docs, the token is available straight away in the request.env['omniauth.auth'] hash as request.env['omniauth.auth'][:credentials][:token].token.

I was hitting my head against the wall trying to figure out why my POST requests to https://login.bigcommerce.com/oauth2/token with the params[:code] weren't going through. If you try to do this additional step to get the token, you'll get a invalid_grant error message.

In hindsight, this gem's readme doesn't mention that you need to do that additional step, but maybe this will be a handy pointer for someone else.

omniauth.auth nill

Guys I'm having this problem when trying to perform authentication using lib version omniauth-bigcommerce (0.3.3)

/config/initializers/omniauth.rb

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :bigcommerce, ENV['BC_CLIENT_ID'], ENV['BC_CLIENT_SECRET'],
  {
    scope: "store_payments_methods_read store_stored_payment_instruments_read_only store_v2_content_read_only store_v2_customers_read_only store_v2_default store_v2_orders_read_only store_v2_products_read_only store_v2_transactions_read_only users_basic_information",
    client_options: {
      site: 'https://login.bigcommerce.com'
    }
  }
end

config/routes.rb

get '/oauth' => 'omniauths#callback'
get '/load' => 'omniauths#load'
get '/uninstall' => 'omniauths#uninstall'

app/controllers/api/v1/omniauths_controller.rb

class Api::V1::OmniauthsController < Api::V1::BaseController
  skip_before_action :validate_access_token, only: [:callback, :uninstall, :load]

  def callback
    auth = request.env["omniauth.auth"] # nill ever
  end
end

Is this gem still maintained?

Hello ๐Ÿ‘‹

Wondering if this is still being maintained - there doesn't appear to be a commit in over a year and the dependencies are getting a little dated.

For example, the oauth2 gem dependency is locked to a version that is now 2 years out of date...

Happy to throw a PR your way if it will get some consideration!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.