Closed esp0314 closed 5 months ago
Thanks @esp0314 for reporting the bug, Will verify and get back to you asap.
Can you please verify the logs in Output window after the first attempt and see what headers are sent?
You can verify the access token is sent or not in 1st attempt
also you can compare the logs with 2nd attempt request
1st attempt
2nd attempt
Thanks for sharing the logs.
how you are saving the access token from response to Local Env?
Will try to re-produce the issue here locally
Basically, we have a a main request that is requiring authorization token, and this main request has a pre custom script that will run another request that returns the access token and used "setTo" to save the token in local environment.
Little confused, want to clarify more
The screenshot above is it main request? And where is the above script running?
Sorry for the confusion. I have edited the previous reply
I think you are using it wrong.
You are setting the access_token after the main request is executed in Tests, that's why the main request header is not getting the access_token value.
You should set the access token directly in the pre-req script.
var response = await tc.runRequest("reqId");
tc.setVar("access_token", response.json.access_token, "local");
Hi @rangav, I see your point, your suggestion is the same implementation as mine. The only difference is that, saving the token is in the pre-req script, while mine is i saved it via UI. We have been implementing this kind of setup since we started using thunderclient as our primary tool in api testing. As i have mentioned in the previous thread, it is working on the previous version.
Here's the setup:
Thanks, now I understand how its setup. Its a correct setup, no need to change anything.
i will try to re-produce the issue and get back to you asap.
Thank you!!
We identified the bug and will publish a fix later today. Thanks for reporting.
This bug is fixed and published to the marketplace. Please update to v2.19.4
.
You can see all the features released in this update https://github.com/rangav/thunder-client-support/releases/tag/v2.19.4
Please test it and let me know your feedback
Hi @rangav,
Verified to be fixed. Thank you
Thanks for confirmation
@rangav, After this bug is fixed(https://github.com/rangav/thunder-client-support/issues/1488), we have updated the thunderclient version to v2.19.0 and cli v.1.12.1, but we encountered another issue.
Our api endpoint is requiring Authorization, and before this endpoint is executed, we must retrieve first the authorization tokens. In our setup, we have a pre-run api that returns tokens and saved in local environment and will be used as authorization headers in our main endpoints. Looks like the authorization is not recognized during the initial execution and it is giving 401 Unauthorized response. And it is only recognized when the endpoint is executed the 2nd time around. Please help check
Pre-run endpoint![image](https://github.com/rangav/thunder-client-support/assets/148940089/b26122b4-5741-4d0a-b882-86e8c3c09648)
Token saved in the local environment![image](https://github.com/rangav/thunder-client-support/assets/148940089/a0d92102-df10-4acf-8cd1-3f0d36ccc199)
Main endpoint![image](https://github.com/rangav/thunder-client-support/assets/148940089/6b57e7dc-52d6-4624-a34e-95ffdc23ec9c)
2nd attempt![image](https://github.com/rangav/thunder-client-support/assets/148940089/21f2a3a5-2ab3-42c4-a5f8-31022fc812c5)
We have to revert to v2.18.0 and cli 1.12.0 and it is working fine for the authorization token headers, but we have to deal with the file not found issue again(https://github.com/rangav/thunder-client-support/issues/1488)