SmartThings Cloud Connector hosted on Azure

I’m trying to develop a SmartThings Cloud Connector hosted on Azure.

When creating the project, I use the “WebHook Endpoint” option.

I have configured Entra ID to redirect to the same eight URLs as in the OAuth project at Schema Devices and Custom Capabilities - Developer Programs / Tutorials - SmartThings Community

I have configured SmartThings to target the URL of my Azure Function.

The authentication flow works fine but it never redirects to my Azure Function. It redirects to c2c-us.smartthings.com/oauth/callback with the state and the code parameters. Displaying a “Pretty-print” web page.

The documentation states that it’s my function that should be called with these parameters.

Am I missing something? I cannot find any tutorial or information on how to use SmartThings with Azure.

I’ll tag @nayelyz and @Itati here as I think they will be best placed to help you.

I’ve never used a C2C Schema but I can see that the ‘documentation’ you linked to suggesting a redirect to your function is for an OAuth-In app which is a different animal and that will probably confuse the issue. With OAuth-In your app requests access to SmartThings. My limited understanding is that with a Schema it is SmartThings requesting access to your app.

1 Like

Hi @aalmada

Could you please provide the Viper ID? You can find it in the Developer Workspace.

viper_03ea2b50-0423-11f0-9560-4dab7bc543b1

Hi @aalmada

Could you please provide the time when this issue occurred? Since we are in different time zones, it would be helpful if you could provide the timestamp of when the error happened, along with your local timezone.

The engineering team mentioned that it is important to validate the following:

  1. SmartThings app configuration – Ensure that the SmartThings app is set up to handle deep links.
  2. Deep link permissions – Verify if your operating system (Android/iOS) allows the app to intercept deep links correctly.

Once we have this information, we can continue investigating the issue.

Hi @Itati,

My latest test was at 2025/03/21 19:07, Western Europe Time Zone (UTC+00:00).

Sorry but I don’t understand your suggestions about deep links.

  1. SmartThings app configuration - Is this something I need to set on the device app or on the project settings?
  2. Deep link permissions - I’m using Android 14. I believe it support deep linking.

I think they mean to go to the App Info in the Android Settings.


1 Like

Hi @Itati
I tested once more just now (2025-03-24 9:36) making sure that I had the application set with “Open supported links” on (as described by @orangebucket). The results were the same.

Hi @Itati
I’m now using the following App ID: viper_8b33af80-04d9-11f0-a5b7-d31f134beab0

Latest test was now at 15:11 UTC

@Itati Any feedback or idea?

HI @aalmada
The engineering team is requesting additional information to continue investigating your case. Could you please reproduce the issue again, record a video while it happens, and pull the mobile logs immediately after?
Additionally, we need you to provide the exact time when you reproduced the issue so we can align the data with our records.

Note: provide the timestamp of when the error happened, along with your local timezone.

`

If you have Android, follow these steps:

  1. Go to Menu > Gear Icon > About SmartThings
  2. Tap the SmartThings logo 10 times.
  3. This will open the developer’s space > tap ‘report a problem’
  4. This will send you to the report page. Select a frequency and write a short description of the issue.
  5. Click on “Report” and a log file will be generated for you to send over email, please do to build@smartthings.com

Thanks!

Could you please confirm if the email account registered in the forum is the same one you use for SmartThings?

I used my personal email on the app but the professional email on the forum.

Hi @aalmada

Just to confirm, please make sure you’re following this flow:

  1. You register your Schema project with the correct URLs for your OAuth server and Schema Connector
  2. When you go to “my testing devices”, it will start the onboarding flow where your OAuth server’s URL will be called. This is where you show your Login page to the user.
  3. Once he authorizes, you need to send an authorization code to SmartThings included in the redirect URI, which is one of the of the listed here.
  4. At some point, ST will request your cloud to exchange that authorization code for an access code at the Token URI you provided during registration
  5. Then, you should start seeing activity in your Schema Connector starting with the “grantCallbackAccess” interaction.

Please, let me know you’re following those steps or if you have questions about them.

Hi @Itati

Points 1 and 2 are working.

Point 3, the OAuth server is redirecting to the 3 listed URLs.

I don’t understand point 4. I’m developing a SmartThings Schema. The diagram at Bring Your Cloud Connected Devices to SmartThings | Developer Documentation | SmartThings does not show that step. This other page OAuth Integrations | Developer Documentation | SmartThings does mention it but I don’t think it applies to a schema app as @orangebucket pointed up above.

In an OAuth-In integration your app authenticates with SmartThings in order to get OAuth tokens to access the API. So your app initiates an authentication with SmartThings which, if successful, results in a temporary code being sent to the redirect URL. Your app then sends that code to SmartThings and receives an access token in return. SmartThings doesn’t need to explicitly authenticate with your app, it just sends signed POSTs to the target URL it has been told about.

With a Schema app SmartThings authenticates with your platform (for want of a better word) in order to get tokens to access it. In stages 2 and 3 SmartThings initiates this authentication and, if successful, receives the temporary code on its redirect URL. It will then need to send that code to your platform to get the actual access tokens and that is what stage 4 is.

There is still a need for your platform to have access tokens for SmartThings. That’s where step 5 comes in.

If this has just confused the issue please ignore it. I am just trying to plug the timezone gap.

1 Like

Hi! @orangebucket thank you so much for the clarification.
Let me see if I understood correctly. After all the OAuth flow, SmartThings sends a grantCallbackAccess payload to my Azure Function. The function has then to send an accessTokenRequest payload to the URL specified in callbackAuthentication. SmartThings will replay with an accessTokenResponse payload. Only then, SmartThings sends a discoveryRequest payload to the function.
Is this right? The connect-using-smartthings-schema diagram doesn’t show any of these callback steps.

I’ve never actually tried it, but it is certainly what I would expect.

I don’t like those flow diagrams they insist on using. It would be OK if the following pages went on to detail each step in order but they don’t. ‘(3) The access is granted’ in particular is doing a remarkable amount of heavy lifting. Not only does it mask the OAuth flow, but it masks the transition from setup activity to actually using your Schema Connector.

1 Like

@orangebucket Thinking about it, the grantCallbackAccess should be used to authenticate for the callback. It should have nothing to do with OAuth authentication flow.

I’m now working with the people that configured Azure Entra ID to try to figure if we’re missing anything on our side.

Up until now, our webhook URl (Azure Function) has never been called. The SmartThings app keeps redirecting to https://c2c-us.smartthings.com/oauth/callback with some state and code parameters.