webhooksite / webhook.site

⚓️ Easily test HTTP webhooks with this handy tool that displays requests instantly.
https://webhook.site
Other
5.44k stars 423 forks source link

`expiry` is not available as a parameter for creating tokens through the API #166

Open edrichhans opened 2 months ago

edrichhans commented 2 months ago

Hi! I love your project, and I was surprised to see this merged https://github.com/webhooksite/webhook.site/pull/164 when I was trying to set up helm. Hopefully this didn't add more problems to your repo.

I wanted to use the expiry feature in the POST /token endpoint, but it doesn't seem to be available in this open source version https://github.com/webhooksite/webhook.site/blob/ca6fcb9e2b8612e5a15872dae755459e36b6287e/app/Storage/Token.php#L24

However, the cloud version actually has it, and I can see the expiry and expires_at in the response.

May I know what setup you have for this open source version vs what is being hosted in https://webhook.site? I am happy to make a PR to set the expiry on a token-level, but if I can avoid duplicated work, that would be much nicer.

Thank you!

fredsted commented 2 months ago

Hi Edrich

A simple way to do this would be to add an expiry parameter in the createFromRequest method you linked, use $token->expiry ?? config('app.expiry') rather than simply config('app.expiry') here: https://github.com/webhooksite/webhook.site/blob/master/app/Storage/Redis/TokenStore.php#L58