Skip to main content

Using OAuth2 access tokens with the People API

 

We are trying to use the http://nationbuilder.com/people_api with the Push endpoint to create new donors in the NationBuilder system from our external website. Basically when we process a new transaction we want to record the person in NationBuilder using the API. Obviously asking the donor to approve this action as part of the donation process is a pretty strange, so I'm a bit puzzled by the use of OAuth2 for this use case. 

 

I have been following the documentation here to do the development: http://nationbuilder.com/api_quickstart

I've managed to get things working in PHP as per this guide: http://nationbuilder.com/php_quickstart

 

It seems we need to manually approve the application to get access in order to capture an access token which we can then use to post information to NationBuilder. Am I taking the right approach here? Should I be storing the access token server side to use later down the track for all our API requests? What happens when the access token expires?

Official response from submitted

Sebastian, the authorization is handled on a per-nation basis, so you won't need donors to approve passing their information once you have an access token from the nation. Per the quickstart guide, you'll have a nation administrator authorize the app, you'll get a short-live code back, then exchange if for an access token. That token should be stored securely and can be used again and again to pass information back to the appropriate nation. It expires only if revoked - then you'd need to have your app authorized again by the nation.

Showing 1 reaction

How would you tag this suggestion?
Please check your e-mail for a link to activate your account.