Skip to content

Oauth2 Workflow via node.js

Patrick Stuart edited this page Nov 30, 2016 · 6 revisions

Goal: To install smartapp for enduser with only the code installed in IDE (or published in Marketplace)

Step 1: Copy code from repo to IDE, create new smartapp from our repo https://github.com/pstuart/Open-Dash/blob/master/smartapp/open-dash.groovy

Step 2: go into app settings and enable oauth, Save / Update App Settings

Step 3: grab clientId and clientSecret for authorization.

Step 4: change redirectUri to localhost:3000 at this point, change display name if desired

Step 5: install node.js

Step 6: grab the node.js stoath2.js and other files from https://github.com/pstuart/Open-Dash/tree/master/oauth-examples/node.js

Step 7: install dependencies for script

Step 8: run stoauth2.js "node stoauth2.js "

Step 9: Go to localhost:3000 in browser and complete the auth flow

Step 10: Get bearer token, this is now your access token to use in API

Clone this wiki locally