Name: loomio-oauth-sample
Owner: Loomio
Description: A minimum viable product OAuth application for use with the Loomio API
Created: 2016-02-20 12:07:16.0
Updated: 2017-04-26 07:49:01.0
Pushed: 2017-04-26 07:49:00.0
Homepage: null
Size: 5
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This is a minimum viable application for connecting to the Loomio API via OAuth. (We use version 2)
It's written in Node with the Grant package, but there are plenty of other ways to connect your app via OAuth.
Check out these resources:
(NB: We haven't checked all of these, they're simply the best-looking libraries that a quick search turned up. YMMV.)
To operate this app, create an oauth application by visiting
s://<your_loomio_hostname>/apps/registered
(if you're authing against our production server you'll want loomio.org
here)
Be sure to add the following as a callback uri:
s://<your_app_hostname>/connect/loomio/callback
(if this is running locally, you'll want something like localhost:3001
here)
Then, create a secrets.json file in the root directory, which contains the public and secret keys for your application.
oomio": {
"key": "your_app_key",
"secret": "your_app_secret"
Once that's done, boot up the server
install
index.js
And get an access token by visiting
s://<your_app_hostname>/connect/loomio
(if this is running locally, you'll want something like localhost:3001
here)
You did it! You can now use that access token to make cUrl requests to the API like this:
https://<your_hostname>/api/v1/discussions/dashboard?access_token=<your_access_token>
or
https://<your_hostname>/api/v1/discussions/dashboard -H "Authorization: Bearer <your_access_token>"
Please check out this series of gifs for a more visual representation of how this works.
Happy hacking!
The Loomio Team <3