Cannot get api token: invalid_client

I first create an app with oath enabled. I wrote some simple code and published it.

Then, I tried to quickly test my app and i followed http://docs.smartthings.com/en/latest/smartapp-web-services-developers-guide/tutorial-part2.html#appendix-just-the-urls-please

I did step 1: Get the OAuth Authorization Code.

I authorized my account and i get my code from callback url.

For step 2: Get the API token,

I replaced client_id with my “OAuth Client ID” and secret with my “OAuth Client secret” and code with the one from last step.

However, i got {“error”:“invalid_client”,“error_description”:“Bad client credentials”} error.

Does this happen to anyone before? or am i just missing something?

I’m having that exact issue at the moment

Might be related to my issue too. I’m waiting to hear back from support about it.

Same problem here. I’ve done this successfully several times in the past, but, today, when I try to “redeem” a code for a Bearer access token, I get:

{“error”:“invalid_client”,“error_description”:“Bad client credentials”}

I think I figured it out, when you try to get the token, open another browser and log out, and then type the url.

[quote=“Ronin, post:5, topic:18314”]
you try to get the token, open another browser and log out, and then type the url.
[/quote]might explain why things like a node app aren’t having problems. Wonder if they changed something in the cookie management to “fix” the IDE cookie issue and that made getting a token manually not work.

This worked for me. I did the initial request in a browser to get the code, then used “I’m Only Resting” to issue the request for the bearer token. Worked.

I got a note back from support confirming that they are working on some platform-wide issues that affect OAuth. Hopefully they will be resolved soon.

I feel really stupid, but I still can’t get this to work.

I’ve gone to https://graph.api.smartthings.com/ directly and logged out, then requested the token with:

https://graph.api.smartthings.com/oauth/authorize?response_type=code&client_id=CLIENT_ID&redirect_uri=https%3A%2F%2Flocalhost&scope=app

(where CLIENT_ID is replaced with the client ID from the app settings, of course)

I still get the invalid_client / Bad client credentials issue. I’ve tried with Chrome and Firefox.

Does anyone have any suggestions / corrections to my method, please?

Edit: To be very precise, I’ve also followed the instructions in the documentation at http://smartthings.readthedocs.org/en/latest/smartapp-web-services-developers-guide/tutorial-part2.html#get-the-oauth-authorization-code but I’m still unable to get the authorization code, even after trying a different browser that has never logged in to any smartthings site. I’ve also tried deleting all smartthings related cookies.

Edit2: I’ve noticed something strange, but I’m not sure if it’s related. If I go to the authorize URL, login, then get the invalid_client/Bad credentials error, then just go to https://graph.api.smartthings.com , it looks like I’ve logged in, but it doesn’t show any apps / devices for me. After a couple of clicks between tabs it asks me to log in again and the site works. I still don’t have the OAuth token, though.

Edit3: I’ve also tried a Chrome incognito tab. I’ve noticed that I can put any client ID in, and I always get the same error. I’ve tried with the smartapp installed to my account and with it uninstalled. I’ve tried changing the client ID, republishing, reinstalling, etc. all with no further progress. I guess that I’ll just have to work with the app only installed in the IDE for now, but that’s a bit annoying as the URL changes regularly.