strapi-plugin-preview-button
strapi-plugin-preview-button copied to clipboard
How to add secret token?
http://localhost/preview?type=article&slug=game&secret=JWT_TOKEN_HERE
When i config jwt in config/plugins.js isn't work
I mean jwt token will generate 1 time not every time
expected : i want jwt token generate every time when i open link.
did you try to execute a function there someUrl&secret=generateSecret()
You can create one endpoint and call it to generate a real-time secret, thats what i did
@kristijorgji How about if I want to pass some identifier(id) to the generateSecret()
?
@tapornanan I did exactly this and works fantastic.
Create one api endpoint and call it in the build preview url hook by sending all the entity data. Then you can use the id while creating the secret every time you create the preview url.
It works great, it also means that you make 2 api calls every time you open a content that is in draft mode
to generate the preview url.