thunder-client-support
thunder-client-support copied to clipboard
Put authentication token in headers based on env or custom script
Is your feature request related to a problem? Please describe. Automatically populate authorization details based on saved env, or custom script or such as implemented in postman. https://learning.postman.com/docs/sending-requests/authorization/
Describe the solution you'd like I create a script for authorization and this script will be called at certain time or interval or I'll choose authorization request and some env and some part from the response get extracted to my new request. E.G, I'll put {token} in the auth section of my request, and for Bearer token, access token automatically get extracted based on auth type.
Describe alternatives you've considered https://github.com/Huachao/vscode-restclient/issues/86
Implementation:
@hamidrezaabroshan thanks for the feedback, will look into it.
You can use Tests tab and save token from response to a variable and use it in the next request
https://github.com/rangav/thunder-client-support#setenv
Hi, Is it possible to set automatically before any request? for instance, {{body.accessToken}}
Thanks.
On Fri, Nov 4, 2022 at 3:10 PM Ranga Vadhineni @.***> wrote:
You can use Tests tab and save token from response to a variable and use it in the next request
https://github.com/rangav/thunder-client-support#setenv
— Reply to this email directly, view it on GitHub https://github.com/rangav/thunder-client-support/issues/750#issuecomment-1303304145, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALUYRAZMQIF3MF5ZYLHDK7LWGTY4FANCNFSM574VRSHQ . You are receiving this because you were mentioned.Message ID: @.***>
-- hamidreza
@hamidrezaabroshan how you get data before executing the request?
can you share any screenshots for me to better understand the use-case
I would like to have this feature as well and can provide some context.
I would like to call an API that is hosted on GCP Cloud Run. To authenticate with GCP I use the cli tool gcloud to print my identity as a Bearer token, e.g. gcloud auth print-identity-token.
It would be very handy if this could be called automatically by Thunder Client.
@assensamuelsson do Google Gcp has api to get bearer token?
Good idea! I was able to replicate the api request that gcloud makes to get my token that way. Thanks for the tip!
The feature to execute some kind of script before a request might be valuable though even if I was able to work around it in this case.
Custom scripting is planned for next update, but you may not be able call cli tools
Hi Andreas, How can you replicate the request? Can you describe more?
On Mon, Nov 14, 2022 at 9:15 AM Ranga Vadhineni @.***> wrote:
Custom scripting is planned for next update
— Reply to this email directly, view it on GitHub https://github.com/rangav/thunder-client-support/issues/750#issuecomment-1313127222, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALUYRA4FW3OBN5BNK5AKBYDWIHGXRANCNFSM574VRSHQ . You are receiving this because you were mentioned.Message ID: @.***>
-- hamidreza
Hi Andreas, How can you replicate the request? Can you describe more? … On Mon, Nov 14, 2022 at 9:15 AM Ranga Vadhineni @.> wrote: Custom scripting is planned for next update — Reply to this email directly, view it on GitHub <#750 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALUYRA4FW3OBN5BNK5AKBYDWIHGXRANCNFSM574VRSHQ . You are receiving this because you were mentioned.Message ID: @.> -- hamidreza
Sure,
You can make gcloud print the request it makes with gcloud auth print-identity-token --log-http. You probably also need to set log_http_redact_token to false with gcloud config set log_http_redact_token false to be able to see the body of the request.
@assensamuelsson Just now did some research on executing cli commands in scripts. its possible actually.
So add this feature also which will be part of next update.
thanks for sharing your use-case.
Custom scripting feature is now implemented and published to marketplace, please update to v2.0.0
See all features released https://github.com/rangav/thunder-client-support/releases/tag/v2.0.0
Please let me know your feedback.
@assensamuelsson we now have exec filter to execute a command and get value. have you tested it? any feedback?.
docs link https://github.com/rangav/thunder-client-support/blob/master/docs/filters.md#exec
@assensamuelsson we now have
execfilter to execute a command and get value. have you tested it? any feedback?.docs link https://github.com/rangav/thunder-client-support/blob/master/docs/filters.md#exec
I just tested it and it works perfectly. I was able to put the exec-filter in the Auth Bearer token section of Thunder Client and everything just worked... The only feedback I have is "great work"! I did not expect this to be released so fast 😄
Thanks for confirmation, glad you like it.
That is the advantage of small startup company, we can deliver faster than big companies