Hello,
I’m having issue since January in my device integration in ST.
The flow to add the device I follow is this one:
- The user adds my device on the ST app
- An AWS Cognito login page appears to enstablish the OAUTH 2.0 login
- After correct login the following requests are made to my wenhook:
- grantCallBackAcess during which I save the call back code on my database
- discoveryRequest
- stateRefresh , during this phase I use the call back code to make an accessTokenRequest to https://c2c-eu.smartthings.com/oauth/token using the following data:
{
“headers”: {
“schema”: “st-schema”,
“version”: “1.0”,
“interactionType”: “accessTokenRequest”,
“requestId”: “abc-123”
},
“callbackAuthentication”: {
“grantType”: “authorization_code”,
“code”: “the-just-generated-call-back-code”,
“clientId”: “my-client-id”,
“clientSecret”: “my-client-secret”
}
}
My problem is the response I get here: 401 Unauthorized
{
“headers”: {
“schema”: “st-schema”,
“version”: “1.0”,
“interactionType”: “accessTokenRequest”,
“requestId”: “cc63ff54-ec1f-466e-a7ca-2fd65e8494d7”
},
“globalError”: {
“errorEnum”: “INVALID-CODE”,
“detail”: “the provided code is invalid”
}
}
This request used to work fine, i could then get the acces and refresh token for my integration, save them on my db and than use them to push data to smart things from my backend with subsequent stateRefresh requests. When the acces token expired I used to make accessTokenRefresh request to refresh the access and refresh token on my db and keep the comunication working.
Do you have any clue on why theese requests are not working anymore? Since i can not make the first auth token request all the process i broken, my users can’t see their data updated and so they can not use automations and routines