How can users obtain a token to access the SmartThings API using the OAuth2 method?

  1. If we want to integrate smartthings API functionality, we need to be able user to log in to smartthings and get the corresponding token.
  2. Where can I find these related documents?
  3. I’ve only seen other people’s cases so far:Regarding API Access for Oauth integration

Operation Steps:

  1. Use the SmartThings CLI to create an app and obtain the clientId.
  2. Request through ‘’, and upon logging in, I can obtain the corresponding code.
  3. When exchanging tokens with ‘’ and the code, an error occurs: 404, keymanagement.service.invalid_request-authorization_code_invalid.

Hi, @haofei. Welcome to the SmartThings Community!

Do you mean when you login and authorize the access to your app you get the code, right?
As the error says “authorization_code_invalid”, I’m wondering if you’re using the right code in the request.

Note: Something important to note is that API access app have 500 max installs by default, if you will use more than that, you need to contact our Partners team to see if you can get a higher limit.
Each authorization from a user to each of his/her locations counts as 1 install.