No commit activity in last 3 years
No release in over 3 years
Omniauth strategy for NationBuilder using OAuth2
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.5
>= 0
~> 2.14
~> 1.7

Runtime

>= 1.1.1, ~> 1.1
>= 1.3.1, ~> 1.3
 Project Readme

Gem Version Build Status

Omniauth::Nationbuilder

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.

Installation

Add this line to your application's Gemfile:

gem 'omniauth-nationbuilder'

And then execute:

$ bundle

Or install it yourself as:

$ gem install omniauth-nationbuilder

Usage

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>

Auth Hash

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
	  }
	}

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request