No commit activity in last 3 years
No release in over 3 years
StitchLabs 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

Runtime

 Project Readme

OmniAuth StitchLabs

StitchLabs OAuth2 Strategy for OmniAuth 1.0.

Installing

Add to your Gemfile:

gem 'omniauth-stitchlabs'

Then bundle install.

Usage

OmniAuth::Strategies::StitchLabs is simply a Rack middleware. Read the OmniAuth 1.0 docs for detailed instructions.

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 :stitchlabs, ENV['STITCHLABS_ID'], ENV['STITCHLABS_SECRET']
end

Example app

You can test this gem out by running the sinatra app in /example.

First add the following endpoint to your developer account on StitchLabs:

 http://localhost:9292/auth/stitchlabs/callback

Next make sure your client ID and secret are in your environment as STITCHLABS_CLIENT_ID and STITCHLABS_CLIENT_KEY.

Now start up the app:

cd example
rackup

Finally visit http://localhost:9292. You should be redirected to the StitchLabs staging environment to enter your user credentials. After granting access you should be redirected to a page the shows your granted OAuth token.

Authentication Hash

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

{
  :provider => 'shopify',
  :credentials => {
    :token => 'afasd923kjh0934kf', # OAuth 2.0 access_token, which you store and use to authenticate API requests
  }
}