Search code examples
javascriptnode.jsrestcookies

Cookie in Thunder Client VS Code extension


I am working on an API and Thunder client extension in VS code seems to have change the way of sending cookies along on every request. How do I do that, any help will be appreciated.

Cookie is not sent along with request: I have a REST API, when I log-in I get an accessToken and a cookie, but I need to pass the cookie along on every request to refresh endpoint to get a refreshToken.

The cookie is not showing in Thunder Client.

Watching this Youtube tutorial

To Reproduce: Try to send a cookie to refresh endpoint to get a new refreshToken

Expected Behavior: The cookie is supposed to be automatically sent along on every request to the refresh endpoint

What I tried: I get this error after following the docs

Set Env Failed: Unable to parse left input query - cookie.jwt

code


Solution

  • You would have to set cookie secure option to "false" when generating your refresh Token. (see below):

    secure is set to false

    Thunder client extension in VS code does not recognise localhost development server urls as protected routes (https or http secure) (for example http://localhost:3500/refresh and http://localhost:3500/auth), hence it will not make the token available for requests. So the only option is to set the secure option to "false" to allow it to pass.

    There may be a way to tweak this in the settings or stuff but i have not figured that out, but the good thing is that in production you will be fine with secure option set as true, as the server domain will be recognised as https or http secure.