An OmniAuth strategy for authenticating to Splitwise. To use it, you'll need to sign up for a Consumer Key and Secret.
As of 2020, this gem uses OAuth 2.0 to interface with Splitwise.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself:
$ gem install omniauth-splitwise
For Rack apps, in your config.ru:
use OmniAuth::Builder do provider :splitwise, ENV.fetch('SPLITWISE_KEY'), ENV.fetch('SPLITWISE_SECRET') end
For Rails apps, in config/initializers/omniauth.rb:
Rails.application.config.middleware.use OmniAuth::Builder do provider :splitwise, ENV.fetch('SPLITWISE_KEY'), ENV.fetch('SPLITWISE_SECRET') end
See also: Integrating OmniAuth Into Your Application.
Once a successful OAuth2 request has been made, several fields are available immediately:
auth = request.env['omniauth.auth'] auth['provider'] # => 'splitwise' auth['uid'] # => Splitwise User ID auth['info'] # => A hash containing 'first_name', 'last_name', and 'email' auth['extra'] # => The full user hash from /api/v3.0/get_current_user
Additionally, the bearer token may be extracted and reused:
auth = request.env['omniauth.auth'] token = auth['credentials']['token'] client = OAuth2::Client.new(ENV["SPLITWISE_KEY"], ENV["SPLITWISE_SECRET"]) access_token = OAuth2::AccessToken.new(client, splitwise_token) # Start making API requests: access_token.get('/api/v3.0/get_current_user').parsed
git checkout -b my-new-feature
)git commit -am 'Added some feature'
)git push origin my-new-feature
)RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4