Can't implement OAuth for Samsung SmartThings Cloud-To-Cloud integration

219 Views Asked by At

I am developing a solution for a product and trying to implement C2C connection. I am in stuck with linking SmartThings with my backend via OAuth.

I get request

{
    "lifecycle": "CONFIGURATION",
    "executionId": "41d224ba-7de3-77ac-fe87-a56fa6f325c3",
    "locale": "en",
    "version": "0.1.0",
    "client": { 
        "os": "ios",
        "version": "1.6.17",
        "language": "uk" 
    },
    "configurationData": { 
        "installedAppId": "7393625f-64d5-42cb-a52f-7935a677c4bb", 
        "phase": "PAGE", 
        "pageId": "linkPage", 
        "previousPageId": "", 
        "config": {} 
    }, 
    "settings": {} 
}

And return response, that is rendered in SmartThings App:

{ 
    "configurationData": { 
        "page": { 
            "pageId": "linkPage", 
            "nextPageId": "", 
            "previousPageId": "", 
            "complete": true, 
            "name": "Account Linking", 
            "sections": [ { 
                "name": "Please, link SmartThings to your XXXXXX account", 
                "settings": [ { 
                    "id": "linkAccount", 
                    "name": "Link Account", 
                    "type": "OAUTH", 
                    "required": true, 
                    "urlTemplate": "https://xxxxxx.auth.us-east-2.amazoncognito.com/login?response_type=code&client_id=20kucf9dcg5ju9deqeppugqft1&state=7393625f-64d5-42cb-a52f-7935a677c4bb&redirect_uri=https%3A%2F%2Fapi.smartthings.com%2Foauth%2Fcallback" 
                } ] 
            } ] 
        } 
    } 
} 

Authentication passes successfully and returns code to callback like that: https://api.smartthings.com/oauth/callback?code=9dfea1ca-54e8-47e8-ba90-24f20068ad2b&state=7393625f-64d5-42cb-a52f-7935a677c4bb

But the callback returns HTTP 401.

I've read this topic https://community.smartthings.com/t/cloud-to-cloud-oauth-rest-api/118902 and did not find a solution. No more helpful info I could found on the Web.

Has anybody implemented this with success?

The Support is awful - no response for several days.. From my previous Support contacting experience - they can respond after several weeks...

Thank you!

1

There are 1 best solutions below

0
On

This is a bug of iOS SmartThings application, Android works fine. https://community.smartthings.com/t/cant-implement-oauth-for-cloud-to-cloud/143258/7