Can't implement OAuth for Cloud-To-Cloud

Hello!

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 Cloud to Cloud OAuth (Rest API) 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!

@atlascoder are you using iOS or Android mobile client? Does it work on one but not the other, or broken in both?

Hello, Jim!

I used iOS app on iPhone and also I tested OAuth url directly on Mac through Chrome browser.

I case with the app I did get blank white screen after authentication, and when I tried via Chrome I got to pointed redirect successfully and the redacted page responded with HTTP 401.

Also, I know that to get successful OAuth on SmartThings side, in contrast with my case where I need to authenticate on my backend in order to access to devices data from my cloud, - on SmartThings side special request to ST is required. Maybe such request is required to use OAuth when linking to own cloud too?

Thanks for helping me!

We’ve recently discovered a bug on the iOS mobile app that sounds like what you are experiencing. Engineering is working on a fix.

If you have access to an Android phone, you could check to see if it works there, as there may be other issues that would result in a 401 and blank screen.

No, this doesn’t require any special access.

Stay tuned, I’ll update here when the iOS bug is fixed. My apologies for the inconvenience, I know this is frustrating.

1 Like

Jim, just checked on Android and it works!
Thank you very much for the help!!
We will be waiting for news about fixes for iOS.

1 Like

Hi Jim-
We also would appreciate any status updates on the iOS bug, as we cannot use ST on our iphones.
Thank you for your help.

It will require a mobile app update; I’m not sure on timeline for that, but it is something being worked on with priority. If you haven’t already, open a developer support ticket - they should be able to keep you updated on status of this bug.

This should be working now in the iOS app. If you are still experiencing issues, please get in touch with developer support. Thanks!

2 Likes

Great news, Jim!
We will check near days and leave feedback here.
Thank you and happy new year!

The iOS App works well now, and love the new ST design. I have 20+ motor roller shades (Leviosa, finally officially listed with ST) that work great with ST. Thank you and ST for working this out!

1 Like