usebruno / bruno

Opensource IDE For Exploring and Testing Api's (lightweight alternative to postman/insomnia)
https://www.usebruno.com/
MIT License
27.56k stars 1.27k forks source link

requests still refreshes oauth2 token instead of using the token and sending request #3500

Open dheerajkakwani opened 3 days ago

dheerajkakwani commented 3 days ago

I have checked the following:

Describe the bug

I am following the documentation for client-credentials flow. The token is created successfully at both levels: request or collection however the token is not used inside the requests. Whenever I send request to the application API, the token is refreshed. In timeline I see that bruno still creates new token. Ideally the token should be sent in header Authorization: Bearer <token> but as per documentation it should be a param ?token=<token_value>.

We tried to do a workaround by detaching the oauth2 token as a separate request. We make the token and set the token as envVariable access_token with code: bru.setVar('access_token', "Bearer ".concat(response.access_token)); . Later we use this var in API request header Authorization : {{access_token}}. This works but Auth should be No Auth in this case.

I request you to kindly fix the oauth2 authentication within request or collection.

.bru file to reproduce the bug

No response

Screenshots/Live demo link

see description