A Withings OAuth2 strategy for OmniAuth.
For more details, read the Withings documentation: https://developer.withings.com/oauth2
Add this line to your application's Gemfile:
gem 'omniauth-withings-oauth2'
And then execute:
$ bundle
Or install it yourself as:
$ gem install omniauth-withings-oauth2
Register your application with withings to receive an API credentials: https://account.withings.com/partner/add_oauth2
This is an example that you might put into a Rails initializer at config/initializers/omniauth.rb:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :withings, ENV['WITHINGS_CLIENT_ID'], ENV['WITHINGS_CLIENT_SECRET'], :scope => 'user.info,user.metrics'
endYou can now access the OmniAuth withings OAuth2 URL: /auth/withings.
With the withings API, you have the ability to specify which permissions you want users to grant your application. For more details, read the withings documentation: http://developer.withings.com/oauth2/#tag/scopes
You can configure the scope option:
provider :withings, ENV['WITHINGS_CLIENT_ID'], ENV['WITHINGS_CLIENT_SECRET'], :scope => 'user.info,user.metrics,user.activity'- Fork it
- Create your feature branch (
git checkout -b features/my-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin features/my-feature) - Create new Pull Request