OAuth2 Strategy for Box
Add this line to your application's Gemfile:
gem 'omniauth-box-oauth2'
And then execute:
Or install it yourself as:
$ gem install omniauth-box-oauth2
You can register your application here and get client_id
& client_secret
.
Here's an example for adding the middleware to a Rails app in config/initializers/omniauth.rb:
Rails.application.config.middleware.use OmniAuth::Builder do provider :box_oauth2, ENV["BOX_CLIENT_ID"], ENV["BOX_CLIENT_SECRET"] end
Or If your are using devise add follwing in config/initializers/devise.rb
config.omniauth :box_oauth2, ENV["BOX_CLIENT_ID"], ENV["BOX_CLIENT_SECRET"]
Then add the following to 'config/routes.rb' so the callback routes are defined.
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
Make sure your model is omniauthable. Generally this is "/app/models/user.rb"
{ "provider"=>"box_oauth2", "uid"=>"123456", "info"=> { "name"=>"Pramod Shinde", "email"=>"box_user@email.com", "job_title"=>"Ruby On Rails Developer", "image"=>"https://app.box.com/api/avatar/large/123456", "phone"=>"1234567890", "address"=>"address", "status"=>"active" }, "credentials"=> { "token"=>"box_access_token", "refresh_token"=>"box_refresh_token", "expires_at"=>1451681914, "expires"=>true }, "extra"=> { "raw_info"=> { "type"=>"user", "id"=>"123456", "name"=>"Pramod Shinde", "login"=>"box_user@email.com", "created_at"=>"2014-10-28T00:04:41-07:00", "modified_at"=>"2016-01-01T10:11:16-08:00", "language"=>"en", "timezone"=>"America/Los_Angeles", "space_amount"=>10737418240, "space_used"=>301803, "max_upload_size"=>2147483648, "status"=>"active", "job_title"=>"Ruby On Rails Developer", "phone"=>"1234567890", "address"=>"address", "avatar_url"=>"https://app.box.com/api/avatar/large/123456" } } }
Bug reports and pull requests are welcome. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)The gem is available as open source under the terms of the MIT License.
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