Strategy to authenticate with Nationbuilder in OmniAuth.
This strategy can be used to authorise your application to use the NationBuilder API. At this stage it is not possible to use it to authenticate your NationBuilder supporters.
Add this line to your application's Gemfile:
gem 'omniauth-nationbuilder'
And then execute:
Or install it yourself as:
$ gem install omniauth-nationbuilder
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 :nationbuilder, ENV["NATIONBUILDER_CLIENT_ID"], ENV["NATIONBUILDER_CLIENT_SECRET"] end
Because every nation has it's own slug, and this may be configured at run time if you are supporting authorisation of multiple nations, this is passed by a url parameter.
To authenticate your nation, use
/auth/nationbuilder?nation_slug=<YOUR NATIONS SLUG>
Here's an example of an authentication hash available in the callback by accessing request.env["omniauth.auth"]:
{ :provider => "nationbuilder", :uid => "YOUR NATIONS SLUG", :credentials => { :token => "f4d3b3c9528672fa15181dfd9e63a793f4e754186bbeaad7030b053e1398b84f", :expires => false }, :extra => { :token_type => "bearer", :created_at => 1465867529, :access_token => "f4d3b3c9528672fa15181dfd9e63a793f4e754186bbeaad7030b053e1398b84f", :refresh_token => nil, :expires_at => nil } }
git checkout -b my-new-feature
)git commit -am 'Add 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