Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add secret token? #96

Open
bnsx opened this issue Aug 4, 2023 · 4 comments
Open

How to add secret token? #96

bnsx opened this issue Aug 4, 2023 · 4 comments

Comments

@bnsx
Copy link

bnsx commented Aug 4, 2023

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.

@kristijorgji
Copy link

did you try to execute a function there someUrl&secret=generateSecret()

@kristijorgji
Copy link

You can create one endpoint and call it to generate a real-time secret, thats what i did

@tapornanan
Copy link

@kristijorgji How about if I want to pass some identifier(id) to the generateSecret()?

@kristijorgji
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants