Giter Site home page Giter Site logo

omniauth-dwolla's Introduction

OmniAuth Dwolla

Gem Version Build Status Coverage Status Code Climate security

Dwolla OAuth2 Strategy for OmniAuth 1.0.

Installing

Add to your Gemfile:

gem 'omniauth-dwolla'

Then bundle install.

Usage

OmniAuth::Strategies::Dwolla is simply a Rack middleware. Read the OmniAuth 1.0 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 and getting a token with scope permissions for full user info, send and request transactions:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :dwolla, ENV['DWOLLA_KEY'], ENV['DWOLLA_SECRET'], 
  :scope                  => 'accountinfofull|send|request',
  :provider_ignores_state => true
end

The :scope param is optional.

The default :scope is 'accountinfofull'. It is necessary in order to grab the uid and detailed info for user.

The extra hash will include:

    "raw_info": {
        "City": "Des Moines",
        "Id": "812-111-1111",
        "Latitude": 41.584546,
        "Longitude": -93.634167,
        "Name": "Test User",
        "State": "IA",
        "Type": "Personal"
    }

Exception Handling

If the Dwolla library raises a Dwolla::RequestException, that will be wrapped and re-raised as a OmniAuth::Strategies::OAuth2::CallbackError. The OmniAuth OAuth2 library will, in turn, treat that as a failure due to invalid credentials, passing the CallbackError through Rack's middleware chain.

Note that the Devise::OmniauthCallbacksController provides a good example of handling this scenario.

Maintainer's Note

The omniauth-dwolla gem is currently maintained by masukomi (GitHub, web). PRs will be happily accepted but the tests must still pass (and be updated if necessary). We're dealing with money here folks. We can't be careless.

I'm @masukomi on Twitter and that's the best way to contact me if you have any questions or ideas about this gem. My GitHub notifications page is typically overflowing with stuff from work. ;)

omniauth-dwolla's People

Contributors

masukomi avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

omniauth-dwolla's Issues

support Dwolla Oauth 2.0

From the Dwolla developer site

Major change!
On October 1, 2014, our OAuth implementation will begin to issue short lived access tokens and long lived refresh tokens, instead of simply an access_token.

Today, the /token endpoint returns:

{ "access_token": "abcdefg" }

But starting October 1st, it will return:

{ "access_token": "aD5dERNABG6LIDwUZ0HLj+BhTxnXLNR3WhrIUObJkUPiqe8Gpc", 
  "expires_in": 3600, 
  "refresh_token": "cIwRQqCIZUW3+FUfCNqK6fCaJ2aSRWK2S1I0mhhIvIXg77cv/X",
  "refresh_expires_in": 5184000, 
  "token_type": "bearer" }

This initial change should be non-breaking. Any access tokens generated between October 1, 2014 and March 1, 2015 (the transition deadline) will have an extended lifetime and will be valid until March 1, 2015.

On March 1, 2015, access tokens will have a lifetime of 1 hour, and refresh tokens will have a lifetime of 60 days. This is a breaking change. Note that it is still possible to maintain authorization indefinitely without user intervention by simply using your refresh token to generate a new access token and refresh token pair.

As always, we're happy to help you transition to the new OAuth implementation; just get in touch!

BUG: undefined method `downcase' for :oauth_token:Symbol

Not sure if this is a bug in the dwolla gem, or if it's in the omniauth-dwolla gem, so I thought I'd start here. After clicking the authorize button for the Dwolla app, I receive the following stack trace:

/usr/lib/ruby/gems/1.8/gems/dwolla-0.0.12/lib/dwolla/user.rb in update_attributes
send("#{key.downcase}=".to_sym, value)
/usr/lib/ruby/gems/1.8/gems/dwolla-0.0.12/lib/dwolla/user.rb in each
attrs.each do |key, value|
/usr/lib/ruby/gems/1.8/gems/dwolla-0.0.12/lib/dwolla/user.rb in update_attributes
attrs.each do |key, value|
/usr/lib/ruby/gems/1.8/gems/dwolla-0.0.12/lib/dwolla/user.rb in initialize
update_attributes(attrs)
/usr/lib/ruby/gems/1.8/gems/dwolla-0.0.12/lib/dwolla/user.rb in new
User.new(:oauth_token => access_token)
/usr/lib/ruby/gems/1.8/gems/dwolla-0.0.12/lib/dwolla/user.rb in me
User.new(:oauth_token => access_token)
/usr/lib/ruby/gems/1.8/bundler/gems/omniauth-dwolla-1aa44ef77e41/lib/omniauth/strategies/dwolla.rb in user
@user ||= ::Dwolla::User.me(access_token.token).fetch

So it seems to be expecting a string, but it's getting an oauth_token class instead.

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.