node-wot icon indicating copy to clipboard operation
node-wot copied to clipboard

Existing client re-use without credentials set

Open danielpeintner opened this issue 2 years ago • 0 comments

    I found another unexpected behavior:

If I read a property with a specific formIndex

const interactionOutput = await thing.readProperty("test", { formIndex: 0 });

and if a client already exists I get a client for that protocol without credentials set. If no client exists everything works fine.

https://github.com/eclipse/thingweb.node-wot/blob/07494392e1def691f06adeae4224afac7cd4cd65/packages/core/src/consumed-thing.ts#L491 This retrieves the client from servient leading to a client without credentials.

https://github.com/eclipse/thingweb.node-wot/blob/07494392e1def691f06adeae4224afac7cd4cd65/packages/core/src/consumed-thing.ts#L493 This instead returns a valid client with credentials set.

Should the client always be retrieved with this.getClients().get(scheme) like here? https://github.com/eclipse/thingweb.node-wot/blob/07494392e1def691f06adeae4224afac7cd4cd65/packages/core/src/consumed-thing.ts#L512

Originally posted by @ilovemilk in https://github.com/eclipse/thingweb.node-wot/issues/890#issuecomment-1339239278

danielpeintner avatar Dec 06 '22 13:12 danielpeintner