OAuth with the third-party device cloud (oauth out to a third-party cloud)
When your SmartApp Connector receives the device list from the third-party device cloud with a GET request, the SmartApp Connector should then issue requests to create a device in SmartThings Cloud for each device in that list. This step must occur in the PAGE phase of the CONFIGURATION lifecycle phase, while the SmartApp Connector is being installed.
Here is an example of a request body showing the PAGE settings
for the authentication request into the LIFX cloud.
The LIFX cloud will respond to SmartThings Cloud with a urlPath
string that contains the necessary authorization and tokens. SmartThings Cloud will then call the SmartThings Connector with this urlPath
with the lifecycle
of OAUTH_CALLBACK
.
{% textbox warning IMPORTANT %}
{% endtextbox %}
#
Create the device in SmartThings CloudWhen your SmartApp Connector receives a list of devices from the third-party device cloud, the next step is to create these devices in SmartThings Cloud. Note that these devices are created at the user's Location in SmartThings Cloud.
Here is an example of a POST request body to create a device, and the response back from SmartThings Cloud.
{% tabCodeBlocks %} {% codeblock REQUEST lang:plain %} { "label": "Living room light", "locationId": "0c0b935d-0616-4441-a0bf-da7aeec3dc0a", "app": { "profileId": "6f5ea629-4c05-4a90-a244-cc129b0a80c3", "installedAppId": "6f5ea629-4c05-4a90-a244-cc129b0a80c3", "externalId": "Th13390" } } {% endcodeblock %}
{% endtabCodeBlocks %}