This gem provides a simple way to authenticate to Weebly Web API using OmniAuth with OAuth2.
Add this line to your application's Gemfile:
gem 'omniauth-weebly'
And then execute:
$ bundle
Or install it yourself as:
$ gem install omniauth-weebly
You'll need to register an app on Weebly, you can do this here - https://weebly.com/developer-admin
Usage of the gem is very similar to other OmniAuth strategies.
You'll need to add your app credentials to config/initializers/omniauth.rb:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :weebly, 'app_id', 'app_secret', scope: 'read:site,write:site'
endPlease replace the example scope provided with your own.
Read more about scopes here: https://dev.weebly.com/about-rest-apis.html
Or with Devise in config/initializers/devise.rb:
config.omniauth :weebly, 'app_id', 'app_secret', scope: 'read:site,write:site'Here's an example auth hash, available in request.env['omniauth.auth']:
{
:provider => "weebly",
:uid => "1111111111",
:info => {
:email => "[email protected]",
:language => "en"
:name => "Bryan Ashley"
}
}- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request