Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Cannot override Collection Basic Auth with request specific Bearer Token #960

Closed
kpau opened this issue Nov 13, 2023 · 6 comments
Closed

Comments

@kpau
Copy link

kpau commented Nov 13, 2023

I have a collection with Auth set to Basic Auth:
image

In the collection there is a GET Request, which has a Bearer Token auth:
image

When I execute the request and observe the "Timeline" tab on the right, I see that it still uses the Basic Auth credentials:
image

I would expect that it will use the Bearer Token Auth specified in the request.

If I disable the Collection Auth (set it to No Auth), then the request correctly uses the Bearer Token auth:
image

I am using Bruno v1.1.1

@n00o
Copy link
Contributor

n00o commented Nov 13, 2023

You can fix this by using the Collection's Headers tab and add a Authorization header while setting its value to:
Bearer {{accessToken}}

Then every request inside of this collection will use that same header for its authentication. This is not the most ideal solution but fortunately others have voiced this issue too in #816 and it should be fixed in #907.

@btgs-0
Copy link

btgs-0 commented Nov 13, 2023

@kpau if you're able, please try out my feature branch https://github.com/btgs-0/bruno/tree/feature/auth-from-collection and let me know if it works for you

@kpau
Copy link
Author

kpau commented Nov 14, 2023

@n00o , Thanks for the info. But my issue is a bit different compared to #816. I understand that No Auth uses Collection auth, but in my case I am explicitly setting another type of Auth and it is still using the Collection auth. The issues are related so the root cause might be the same.

@btgs-0 , Thanks for the PR. If I have time today, I'll test the branch.

Even if the issue is fixed with this PR, it is good to have both issues documented for future reference.

Edit: I tested the PR and it resolves my issue. Thanks!

@btgs-0
Copy link

btgs-0 commented Nov 14, 2023

thanks for testing my PR @kpau. And thanks @n00o for connecting the dots, my PR incidentally fixes this issue by making the collection auth inheritance explicit

@karloluis
Copy link

It appears that #1667 addresses this by explicit requirement of inheritance.

@sanjai0py
Copy link
Member

Closing this issue as the PR implementing the feature has already been merged. Check out this #816 (comment) comment demonstrating the PR's behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants