Insomnia: [Feature Request] Allow variables to expire after a set time.

Created on 29 Feb 2020  路  3Comments  路  Source: Kong/insomnia

Problem

Our server provides 5 minute session tokens. Currently I can either (1) manually send a login request to save the session environment variable when I want a new token or (2) configure insomnia to login every time I send any request.

There are occasional other problems with using a new session token every time, which precludes always using option 2 for me.

Desired solution

I would like to configure the session environment variable to:

  1. re-send when necessary
  2. expire after X minutes

This would avoid spamming the server with login requests but also avoid the annoying manual session refresh. The feature seems general enough that it would be useful for other authentication mechanisms or dependent request triggering.

question

Most helpful comment

@gschier This is not a specific case, when working with a authenticated API is a common case to have to refresh tokens after several minutes.

I'm chaining my request using a response tag requesting to my token server with trigger behavior to "no history" and sometimes I have to manually refresh the token.

It would be very useful to have a trigger option "expire after..."

All 3 comments

Since this is such a specific use-case, I suggest writing a plugin to accomplish what you need. For example, you could have a plugin that stores its own token and manually refreshes it (if needed) on the "request hook" event. You could also fork the current Response plugin to add the functionality needed as well.

@gschier This is not a specific case, when working with a authenticated API is a common case to have to refresh tokens after several minutes.

I'm chaining my request using a response tag requesting to my token server with trigger behavior to "no history" and sometimes I have to manually refresh the token.

It would be very useful to have a trigger option "expire after..."

I took at stab at implementing this (#2284) and it turned out to be simple and, I think, generally useful when dealing with any time-sensitive API.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

slashsbin picture slashsbin  路  4Comments

pinggi picture pinggi  路  4Comments

Fyb3roptik picture Fyb3roptik  路  4Comments

claratorres picture claratorres  路  3Comments

sapeish picture sapeish  路  4Comments