500 Internal Server Error during oAuth Authorization

oauth

(Rohit Gandhe) #1

I get the dreaded 500 error when trying the auth workflow to get an access token.

Is there any way to get the actual stack trace to see what I am doing wrong? Do you see anything wrong/missing from the request?

Thanks for your time.


[RELEASE] Improved Mobile Presence (Android only)
(Geko) #2

I suspect they may do some rate limiting on auth calls. Anyway, I also start getting 500’s when testing my app once in a while.


(Rohit Gandhe) #3

Thanks @geko
This has been happening for two days now. Do you see anything wrong with the request?


(Geko) #4

Actually, you also have to include redirect_uri in your request.


(Rohit Gandhe) #5

I did earlier with same results, but I thought of removing it for calling from Postman


(Rohit Gandhe) #6

Can someone from smartthings look into the logs based on the reference code or comment on what could be wrong here?


(Rohit Gandhe) #7

Hi @geko! Sorry to bother you again but you are the only one seem to be responding (and thanks for that :slight_smile: ).
I see that I am logged in because “My Devices” etc links show up in the response, but I was expecting a token in a JSON response, which is not part of it. Also the response is in html. Any thoughts?


(Rohit Gandhe) #8

I was using my friend’s credentials who I gave access to my account. These errors can certainly use some finesse. :confused:


(Arn B) #9

Old thread but having the same problem. Support was unable to give my any suggestion other than trying here. This is the latest thread I could find, and I’ve read most of them.

I can get the code, makes me sign in and authorize then redirect back to the initiating program and attempt to get the token, without success using https://github.com/adoy/PHP-OAuth2

Any suggestions or working PHP example appreciated.

Here is a snippet of the PHP code

const TOKEN_ENDPOINT         = 'https://graph.api.smartthings.com/oauth/token';
$params = array('code' => $_GET['code'], 'redirect_uri' => REDIRECT_URI, 'scope'=>'app');
$response = $client->getAccessToken(TOKEN_ENDPOINT, 'authorization_code', $params);

the getAccessToken function adds the proper header, Client_id, and Client_Secret. Same result with or without the scope=app param

Oh No! Something Went Wrong!

Error
500: Internal Server Error
URI
/oauth/token
Reference Id
2ded8225-8e6f-4752-8ff0-a07d33032c04
Date
Tue May 15 18:00:14 UTC 2018


(Arn B) #10

Just fixed it!
Changed connection points
from
https://graph.api.smartthings.com/
to
https://graph-na04-useast2.api.smartthings.com