Is there a way to make a public cloud function?

I would like to make a function that I published via Particle.function() available without authentication.

e.g. instead of this:

curl -X POST -H "Authentication: Bearer <ACCESS_TOKEN> \
    https://api.particle.io/devices/<DEVICE_ID>/my_function

I could just do this:

curl -X POST https://api.particle.io/devices/<DEVICE_ID>/my_function

Am I able to do that?

Hi, I do not think is possible.

The recommended way to do this is to create a simple server with no authentication that embeds the Particle access token for your device in its protected server side code.

You could also do this by putting your device in a product, even if there's only one device. You then create an API user that only has devices.function:call scope. While we generally don't recommend embedding an access token in web page Javascript, that token should be relatively safe since it has very limited permissions.

1 Like