I am implementing the SmartThings OAuth flow, but I encountered an issue during the Access Token exchange step. Here are the steps I followed:
- Displayed the authorization page to the user
I used the following URL to display the authorization page:
bash
https://api.smartthings.com/oauth/authorize?client_id=${clientId_from_app}&response_type=code&redirect_uri=${redirect_uri_from_app}&scope=${scopes_from_whitelisted_inApp}
- Received the Authorization Code
After the user authorized access, the redirect URI successfully received the Authorization Code. - Error during Access Token exchange
When attempting to exchange the Authorization Code for an Access Token, I received anInternal Server Error
response. Here’s the request I made:
bash
curl -X POST "https://api.smartthings.com/oauth/token" \
-u "${clientId_from_app}:${clientSecret_from_app}" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=authorization_code&client_id=${clientId_from_app}&code=${codeReceived}&redirect_uri=${redirect_uri_from_app}"
4.Response*:
json
{
"error": "server_error",
"error_description": "Internal Server Error"
}