Git Product home page Git Product logo

smartthings-auth-example's Introduction

SmartThings OAuth Example in Node.js

OAuth to SmartThings, hit an "API Access App", get JSON of all things.

This barebones Node application uses a series of requests authenticate a user to SmartThings, install a "SmartApp" (see smartapp.groovy) for that user, and finally fetch JSON from that SmartApp of all their things.

This program does...

  • Authenticate a user to ST using OAuth 2.0
  • Request the SmartApp installation's unique URL
  • Immediately GET /things from that SmartApp
  • Dump JSON of the things back to the browser

This program does not...

  • Create a user local to the Node app
  • Cache the OAuth token
  • Serve as a foundation for a full implementation, just a starting point

Setup

  • Create a SmartApp through the SmartThings Wed IDE with OAuth enabled
  • Copy into that app the contest of smartapp.groovy
  • Install Node.js
  • $ npm install
  • Adjust configuration in index.js (line 4)
  • Run index.js
  • Open the server root in a browser.

Notes

There is a known issue with sending "localhost" in your callback url to the SmartThings OAuth server (configuration line 7). Use an IP address (terribly inconvenient for a development environment) or a tool like Katon.

smartthings-auth-example's People

Contributors

tbeseda avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.