Unable to understand why we need to set key in project 3

Hi, I am unable to understand that why do we need to use the setKey function in project 3, controlling LED, and not in project 1.

Hi @vijayolivefloor,
Are you referencing this(IoT and ML Training)?

Yes @raghav.srivastava
Pl tell why do we need to use the setKey function in project 3 and not in project 1

@vijayolivefloor In project 3, we don’t set any variables in the Hardware section but we directly jump to the code section, since we have not set any variables we can’t access any pin using variable names in javascript. So the only way we can access the pins is by using APIs, to identify the target device. The code in project 3 doesn’t have to be written in the bolt cloud environment, it can be written independently. The setkey function sets the API key and device name to easily recognize the target device. For more detailed understanding of underlying concepts, click here to see the source code for Bolt javascript library. If you still have any doubt or need any other help, do let me know.

Thank you @raghav.srivastava, your reply helped to solve my doubt. :grinning:

1 Like

Setkey helps to authenticate the user, whenever it tries to get the data from Boltcloud. Its a very important feature which helps in authentication.