cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Permissions while connecting C-SDK to ThingWorx.

ysb
6-Contributor
6-Contributor

Permissions while connecting C-SDK to ThingWorx.

Hi Team,
 
I have a device connected to a remote Thing by using an AppKey (DefaultAppkey) with no permissions (The associated User has no permissions). What I'm trying to do is: 
 
- To use that DefaultAppkey only to have the device connected to the Thingworx (appearing in the Unbound Thing List), so that I can create a Remote Thing, a new User (DeviceUser) and Appkey (DeviceAppKey) (with specific permissions to run services and read/write remote properties) 
- After completing the last step, I want to send that new DeviceAppKey to the device through a remote service (Let's call it SendAppKey_Service) and set some Remote properties.
 
I've made a service to create all these Entities, using EntityServices, set the remote properties and run the Remote Service to send the DeviceAppKey to the device (Let me call it CreateDeviceEntities_Service). 
 
That CreateDeviceEntities_Service is called from the Thingworx side, by an Administrator User, once the device appears in the Unbound Thing list (connected using the DefaultAppkey ). 
 
I can run the CreateDeviceEntities_Service on thingworx side as Administrator but both SendAppKey_Service and setting remote properties just don't work.
I've already tried to run everything step by step and manually, and I can't set the remote properties (it allows me to change its value but once I refresh the properties, it returns to its original value)
and the SendAppKey_Service doesn't run properlly.

Even when the Remote Thing is created, I have that error message in the C-SDK logs:
 
[ERROR] 2019-07-19 12:15:02,806: twMessaging::handleMessage: Response ID 6 has code 160: Entity DeviceThing.T does not exist or is not yet associated with a Thing
[ERROR] 2019-07-19 12:15:02,806: twSubscribedPropsMgr_PushPropertyInfoList: Error pushing properties for DeviceThing.T.  Error: 1110.
[ERROR] 2019-07-19 12:15:02,806: twSubscribedPropsMgr_PushProperties: error pushing or persisting property list, code: 1110
 
What would be the best way to implement this workflow ?

Is it possible o set a remote property value and run a remote service while using an Administrator User in the Thingworx but having the device connected through an AppKey with no permissions ? In that case, am I supposed to get permissions errors in the Thingworx Log ?
 
 
Note: I'm using ThingWorx 8.4.2. and ThingWorx Edge C-SDK-2-2-3-1545 running in the device.
 
Thanks in advance.
1 ACCEPTED SOLUTION

Accepted Solutions
PaiChung
22-Sapphire I
(To:ysb)

The initial connection with the default appkey will be a connection only, there won't be context I think for the Admin user process to send a command back to the device that way.

If you give the default appkey perhaps permissions to run a specific registration service, it can pick it up that way.

View solution in original post

3 REPLIES 3
PaiChung
22-Sapphire I
(To:ysb)

Looks like you are missing visibility permissions for the new appkey user?

 

Everything else looks ok I think.

Registration could btw be initiated upon connection from the device side as well so you don't have to monitor for connected devices on a continuous basis.

 

ysb
6-Contributor
6-Contributor
(To:PaiChung)

Hi @PaiChung ,

Thanks for your fast reply.

The new appkey user is working fine, I'am having problems with the default appkey (initial one with no permissions).

Is it possible o set a remote property value and run a remote service while using an Administrator User in the Thingworx but having the device connected through an AppKey with no permissions ?

Considering your answer, any appkey user will need at least a visibility permission to allow connection between the device and the remote thing, is that right ?

 

Thank you very much.

PaiChung
22-Sapphire I
(To:ysb)

The initial connection with the default appkey will be a connection only, there won't be context I think for the Admin user process to send a command back to the device that way.

If you give the default appkey perhaps permissions to run a specific registration service, it can pick it up that way.

Top Tags