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:

  1. From the function editor, click the lock icon.

    Lock icon

  2. Click add/edit secrets from the pop-up window asking you to choose a secret.
    Add secret

  3. Click Define Secret
    Define secret

  4. 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).

    Fill out secret info

  5. Click Save.

  6. Go back to the pop-up window where you're creating your function and click refresh.


  7. Choose the secret you just defined from the list. Click Add
    Choose secret

  8. The secret will pop up in your parameter window.

    Token appears

  9. Now you can access the secret at function runtime with request.params.

    Use in code

Feel free to ask us any questions or give us feedback in the chat below!