SmartThings Community

HTTP Get Failure - OAUTH


(Jay Basen) #1

I’m working with code written by a developer that integrates a SmartThings hub with a Crestron automation system processor. The code works for him, but not for me. It appears this is may be some sort of an authorization problem. I’ve taken the whole issue of code on the crestron processor out of the way and I’m just trying to get urls in my browser to work. Here is what happens

To start I use the following url to get an authorization code

https://graph.api.smartthings.com/oauth/authorize?response_type=code&client_id=smartapp_client_ID&redirect_uri=http://My_IP_Address&scope=app

where smartapp_client_id comes from the OAUTH properties of the SmartApp on the smartthings web site

I get the following back from SmartThings

http://My_IP_Address/?code=five_digit_code

All that looks good

Now when I try to get the access token I run into problems

I put the following url into my browser

https://graph.api.smartthings.com/oauth/token?grant_type=authorization_code&code=five_digit_code&client_id=smartapp_client_id&client_secret=smartapp_secret_id&redirect_uri=my_ip_address

where smartapp_client_id & smartapp_secret_id come from the OAUTH properties of the SmartApp on the smartthings web site
and five_digit_code comes from the response to the first https get

Now Instead of getting back an access token, I just get the following

Oh No! Something Went Wrong!

Error500: Internal Server Error
URI/oauth/token
Reference Idd9934de6-8e3a-4d07-bad9-efd1931c8539
DateMon Oct 24 19:38:19 UTC 2016

The groovy smart app is published - For Me. It is loaded onto my hub through the iPhone app. And I have added permission in the iPhone app for the SmartApp to work with the devices attached to my hub.

Any ideas on what I’m doing wrong would be greatly appreciated.

Thanks in advance for the help


HUB not showing up in my account. Please HELP?
(Luke - Backend Engineer) #2

When I have seen our OAuth2.0 throw 500s it has been normally been related to the redirect url not matching, so I would start there.


(Jay Basen) #3

Thanks for the idea. I’m just not sure what you mean by “the redirect url not matching”. In my test case here I’m just providing the public IP address of my router in the get, which I’m expecting should in turn redirect internally on my home network back to my latpop and the browser I’m using to generate the Get.

Thanks again for your help.


#4

Alright, so I know its been a while with no response here, but I am getting the same response for my system trying the same thing. Ive looked at my IP/URL for my home system and my forward port settings, but nothing seems to get me a successful authorization.

Any help guys?


#5

Anyone have any ideas? I need to return this Samsung hub if I cannot get it working with my Crestron system.


(Jay Basen) #6

Are you using the code I’m hosting on my github to integrate a smartthings hub with a Crestron system? You can find the code here:

Hope this helps

Jay