You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To use plugin, go to plugins, create new and use this as handleResponse function.
function handleResponse() {
console.log(context.response.getBodyText());
if (/^[\{\[].*[\}\]]$/.test(context.response.getBodyText().trim())) {
const parsedResponse = JSON.parse(context.response.getBodyText());
if (parsedResponse && parsedResponse.access_token) {
context.response.setEnvironmentVariable("jwt", parsedResponse.access_token);
console.log('Environment variable JWT set to:', parsedResponse.access_token);
} else {
console.log('Access token not found in the response.');
}
}
If enabled this will be used in all requests, the ones containing access token will be used to set variables.
To use token as variable just create new request and in Auth tab add {{jwt}}, it should contain latest token each time.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
To use plugin, go to plugins, create new and use this as handleResponse function.
If enabled this will be used in all requests, the ones containing access token will be used to set variables.
To use token as variable just create new request and in Auth tab add
{{jwt}}
, it should contain latest token each time.Beta Was this translation helpful? Give feedback.
All reactions