Cloud Connector webHook endpoint - 'Glitch' example

Hi - I am trying to get the glitch example to work according to the documentation but am not having success.

When I try to add the device in the mobile app, I can find it in Developer mode and select it, choose a room, hit next, then start getting messages from glitch (preparing, etc.). Then am presented with this page:

Mock OAuth2 Server
UserName:

Enter the email address of the person you want to impersonate.

Password:

This is not mentioned anywhere in the documentation or Glitch readme file. What am I supposed to put here? Note that I do not have a Glitch account - I am running anonymously.
I tried putting my email address but that didn’t work, and now am regretting that because I just gave them my email password!! It seems no matter what I provide - valid email or not - it still gives me an error: Connection between SmartThings and Sample Cloud Device encountered an error.

1 Like

Hi, do you mean this example, for a virtual switch?

The page you’re redirected to is the simulated OAuth 2.0 Server, it doesn’t save or validate any data, so don’t worry. This is why you don’t need to use a real email or password (only the email’s format is verified).
Make sure you put the correct values in the cloud credentials of the Schema Connector (see the picture below).

The Webhook URL is the live site URL of your Schema Connector (remixed project in Glitch):
image

This sample doesn’t include the command’s handler, so you’ll receive a Network error when you try to change the device status, eg. turning off the switch.

Take a look at this recent sample for this kind of device:

Thanks for the reply! Yes, that is the Glitch example for a dimmer switch. I have all the correct values in the cloud credentials. Everything matches up with the screen shot you provided.

I even had the webhook URL correct despite the lack of clear info on this in the readme, which only says ‘…add the glitch url as the “Target URL” for the “WebHook Endpoint”’ without specifying WHAT glitch url to use or where to find. Thanks for your additional info, but I’d request that it really needs to be clarified in the glitch ST app readme file.

Still no luck. Here is the error I’m getting:

There is one step I wasn’t 100% sure of:

Once the remixed app is up and running, you can click on "Show (live)" to check your webhook url in the browser.

How do I know the app is up and running? Is there something I need to do? The ‘Show’ menu item says “Preview” your app (not run), and does not say ‘live’ anywhere. If I do click on Show and then either ‘in a new window’ or ‘next to code’, all it ever shows there is the discovery response json.

As you can tell I’ve never used Glitch before…

It’s ok, actually, I’ve seen them change the UI a few times and it took me a while to find the right menu option :pensive:

To get the Webhook URL you’ll use in your Schema Connector, click on “Share” below the project’s name. Glitch provides two URLs, one for you to access (and edit) the code, and the other is where the project is executed (live site).

Glitch runs/saves the code automatically and you can see the logs by selecting “Tools” > “Logs”. There you’ll see if your Schema Connector is called and the interaction types’ request and response.

I couldn’t replicate the error you get, I tracked down the error code from the picture and it’s related to the Token request. For better understanding the process flow is:

  1. You select the connector in the mobile app to install the device.
  2. It sends you to the simulated OAuth server which grants you an Authentication code once you select “Authorize” in the mobile app.
  3. This code is received in your Schema Connector to request the Reciprocal Token used for callbacks.

I believe the error is in step 3, do you see an interaction result in the Connector’s logs?

I found my problem :slight_smile: There was an extra space preceeding the client secret credential in the Developer Workspace. Must have happened when I copy/pasted it from glitch. so USER ERROR!!!

Awesome! Glad you figured it out :smile:
Please, remember to mark the solution for your question. Thanks!

1 Like