bruno icon indicating copy to clipboard operation
bruno copied to clipboard

OAuth 2.0 Token shared between folders

Open TheBlackReverand opened this issue 1 year ago • 2 comments

I have checked the following:

  • [x] I have searched existing issues and found nothing related to my issue.

This bug is:

  • [ ] making Bruno unusable for me
  • [x] slowing me down but I'm able to continue working
  • [ ] annoying

Bruno version

2.0.1

Operating System

Windows 11 Professionnal 23H2 build 22631.5039

Describe the bug

I have one collections with 2 folders.

Each folder have an OAuth 2.0 authentification.

Folder A have a token without scope. Folder B have a token with scope.

Each folder have requests, sometimes a request can be on the folder A and B.

I start a request from the folder A, a token without scope is generated and request return HTTP 200 => perfect I start a request from the folder B, Bruno use the same token, so request return HTTP 401 - need scope => bad

If I go in folder B and make "Get Access Token", I get a token with scope and now request return HTTP 200. After that all request from folder A have scope.

Thanks for this feature, Good luck for fix.

.bru file to reproduce the bug

No response

Screenshots/Live demo link

no screenshot / demo, too many sensive data on screen

TheBlackReverand avatar Apr 01 '25 13:04 TheBlackReverand

Could you try using a different Token ID in this scenario?

If you use the same Token ID with the same auth URL, the tokens will be replaced. Since you need to keep the same URLs, using a different Token ID will allow you to store multiple tokens separately.

Image

anusree-bruno avatar Apr 02 '25 16:04 anusree-bruno

I experienced the same issue in the past, and leveraging the token ID field —as @anusree-bruno mentioned— made it work for me. Use a different token ID for each folder.

Additionally, if you also require different tokens per environment, you can reference environment variables in the token ID so Bruno can differentiate them upon env switch.

Related: #5293

juancrrn avatar Aug 18 '25 14:08 juancrrn