Signed Parameters
How do signed parameters work in views
If you need to obfuscate the parameters in the URL, you can sign the parameter __token
in the URL of your view as a JWT token. This parameter has to be signed with your LATITUDE_MASTER_KEY
that you will find in the .env
file in the root of your latitude project.
If you don’t see a .env
file in your project you can run:
This command will create LATITUDE_MASTER_KEY
in an .env
file
A note on security
It is crucial to add your .env
file to your .gitignore
before deploying to prevent exposure of your LATITUDE_MASTER_KEY
.
LATITUDE_MASTER_KEY
for the production environment.latitude secrets add LATITUDE_MASTER_KEY=<key_generated_by_previous_command>
.Example
Imagine you want to obfuscate the parameter workspace_id
to be used in your query like this:
Normally you would have a URL like this:
But this way anyone can see the name of this secret workspace_id
parameter and try to send a different value. To avoid this you can sign the parameter workspace_id
with the LATITUDE_MASTER_KEY
like this:
This example is using our own JS implementation of JWT but you can easily do this in your server side language.
Now you can use this token in your URL like this