SmartApp OAuth token not working on external REST API's

(Matthew Hartley) #1

We aren’t able to access the suggested REST API below for camera image using the OAuth Token that is negotiated for access to our SmartApp. Specifically, the OAuth Token that was successfully obtained with the “” API.

Suggested REST API for camera image:

Returns the following response using SmartApp auth token:
error: true
type: "AccessDenied"
message: “This request is not authorized by the specified access token”

How do we get by this?

(Joshua Lyon ( Dashboard)) #2

Where did you get the REST API for the camera image?

Typically a successful call to /api/smartapps/endpoints (with a proper OAuth access token) will result in something like:

200 OK
  "oauthClient": {
    "clientId": "myclient",
    "authorizedGrantTypes": "authorization_code"
  "url": "/api/smartapps/installations/8a2aa0cd3df1a718013df1ca2e3f000c"

Then using the URL provided in the endpoints response, you would query one of the endpoints you defined in the mappings of your SmartApp:

mappings {
  path("/switches") {
	action: [
	  GET: "listSwitches",
	  PUT: "updateSwitches"
  path("/switches/:id") {
	action: [
	  GET: "showSwitch",
	  PUT: "updateSwitch"

Ninja Edit: For anyone else who finds this, I see that this appears to be a follow up to this question:

(Matthew Hartley) #3

Yup…we are doing that no problem.

When we query the SmartApp for the Dropcam image we get back just the file name for the Dropcam image:

value: “smartthings-smartsense-camera: afb8d849-dc2b-41c8-a736-d9b487b1ed15.6f3e262cfdaa4a1591143c7c630ae1c6_e27f4075dfdb4d449caffb701d224b2a.jpg”

We inquired about how to access this image file and Harper directed us to this URL below which is outside of the SmartApp url scheme. This URL works in the context of a USER but not in the context of a SMARTAPP.[imagename1]

How do we access a Dropcam file in the context of a SmartApp?