How to get "code" for Access Token?


(Jack) #1

Hi,
I have been looking at: http://docs.smartthings.com/en/latest/smartapp-web-services-developers-guide/authorization.html and I see that in order to get an access token, I must have a code, “The code you received.” However I don’t know how to get this “code”. I have entered in the url on google chrome: https://graph.api.smartthings.com/oauth/authorize?response_type=code&client_id=xxxxxxxxxxxxxxxx&scope=app&redirect_uri=https://pitangui.amazon.com/api/skill/link/M2JG8VGTIBNOSK. I don’t see any “code” after I login. How can I get this “code”?


#2

You have posted this before. You think you’re going to get a different answer now?


(Jack) #3

I have not posted this before. This is a different question. I am looking for the “code”, not the client id/secret. The previous post you are referring to is unrelated to this one.

According to the 1st link I posted, it says:
"This will require the user to log in with their SmartThings account credentials, choose a Location, and select what devices may be accessed by the third party.

The authorization code expires 24 hours after issue."

However, I don’t see the “code” after I do that.


(Tony Fleisher) #4

If you are going to be learning OAuth, I would suggest looking at resources outside of the smartthings docs that might provide better tutorials for this topic. It is a pretty widely used method for authorization.
With the OAuth2 Authorization Code Flow, the code is sent as a query parameter to the redirect_uri if the request is authorized.