Working with Secrets
Blockspring users can save secrets to their accounts, and then authorize specific functions to access those secrets.
Let's say a developer creates 5 functions that all require the same API token. As a user you can authorize access your API token once, and then it will automatically be retrieved whenever you run those 5 functions.
Secrets make it easy for users to use functions that call external APIs since they only have to worry about API tokens once.
Developers - here are the steps you need to take to add a secret to your function:
-
From the function editor, click the lock icon.
-
Click add/edit secrets from the pop-up window asking you to choose a secret.
-
Click Define Secret
-
Provide:
- a user-readable name,
- a variable name,
- an optional sample value (not a real token, but something that looks like it),
- a detailed description for how to get the secret (if it's an API token, what must a user do to get the token?), and
- your own real, secret value (this will be attached to your account for testing, no one will see it).
-
Click Save.
-
Go back to the pop-up window where you're creating your function and click refresh.
-
Choose the secret you just defined from the list. Click Add
-
The secret will pop up in your parameter window.
-
Now you can access the secret at function runtime with
request.params
.
Feel free to ask us any questions or give us feedback in the chat below!