thunder-client-support
thunder-client-support copied to clipboard
oAuth2 Authorization token flow improvements
Please describe feature/problem details and the solution you'd like.
We use a custom authorization header instead of Authorization, which means when we use the oAuth2 flow, we have to manually copy and paste the token to an environment variable.
A possible solution would be: Allow for defining a header other than Authorization in the advanced part of the oauth2 flow.
Another solution would be to make the post-request scripts work with the authorization requests. This way we could set a dynamic variable in memory.
Describe alternatives you've considered I tried something like this
tc.request.setHeader('Custom-Header', tc.request.getHeader('Authorization'))
which also doesn't work and would be another viable solution to our issue
Are you using the free version/paid version/trial: Enterprise customer
Thanks @m-schrepel for the feedback. I will review and add to the roadmap.
This feature has been implemented and published to the marketplace. Please update to v2.25.7.
You can see all the features released in this update https://github.com/rangav/thunder-client-support/releases/tag/v2.25.7
Please test it and let me know your feedback
@rangav for the oauth2 improvements, can I access the OAuth2 tab via scripting?
This doesn't work:
const accessToken = tc.request.auth.oauth2.get('accessToken')
Error in Pre Request Script: - Cannot read properties of undefined (reading 'oauth2')
@aagranovExtend Currently not possible, I will add it in the next update.
We published new update to add further improvements in v2.25.8
New Additions:
- Access authorization header in Post Req Script -
tc.request.getHeader('Authorization') - Added
authproperty to request model in script. To get access token use this -tc.request.auth.oauth2.accessToken. Log auth property usingconsole.log(tc.request.auth)to see all props available.