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

Basic Auth header not sent #329

Closed
nico-m-64 opened this issue Oct 4, 2023 · 7 comments
Closed

Basic Auth header not sent #329

nico-m-64 opened this issue Oct 4, 2023 · 7 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@nico-m-64
Copy link

Hi,
Just say that you made a very very great tool, hope this open source project will be 🚀 all around the solar system ! Thank you so much for your work.

It seems that the header "Authorization: Basic *****" is not sent when configuring the Auth tab with this type.

Have a nice day

@helloanoop helloanoop added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed labels Oct 4, 2023
@l0new4nder3r
Copy link

It works fine for me with version 0.18.0: I just replaced a manually generated "Authorization" (Basic) header with the needed username and password in the "Auth" tab, and I can successfully access a restricted API in one of my apps.

Could you try again, or check if you do not have anything else interfering your test, @nico-m-64 ?

One other thing, though: when using "Generate code" on this new request, the "Authorization: Basic xxx" header is not included in the "curls". Should I create another issue, @helloanoop ?

@dcampagnone
Copy link

Not working for me either. Previously I was using a pre-request script to set the Authorization header. This works fine and in the timeline I can see the Authorization header passed.

Removing this pre-request script and instead using Basic Auth (from the Auth tab) with a username and password the request fails (bad credentials) and in the timeline I don't see the Authorization header at all.

@helloanoop
Copy link
Contributor

helloanoop commented Oct 4, 2023

Yes, it worked for me too in my local tests. But we need to use headers. The current code uses axios inbuilt auth which is resulting in the header not being populated.

Here is the part we need to make changes: https://github.com/usebruno/bruno/blob/main/packages/bruno-electron/src/ipc/network/prepare-request.js#L22-L33

I will send out a patch fix for this later tonight.

One other thing, though: when using "Generate code" on this new request, the "Authorization: Basic xxx" header is not included in the "curls". Should I create another issue, @helloanoop ?

@l0new4nder3r
Fixing this issue should also fix the curl issue in code generator

@francocm
Copy link

francocm commented Oct 4, 2023

I'm playing with Basic Auth on v0.18.0 and observed that Basic Auth works fine if I put hardcoded values. However it breaks if I use variables.

# Example

Works

  • Username: foo
  • Password: foo

Does not work

  • Username: {{my-username}}
  • Password: {{my-password}}

@lared
Copy link
Contributor

lared commented Oct 4, 2023

@helloanoop should it be done there, or in dedicated step where we interpolate everything afterwards? I submitted the latter in PR.

I don't think this is going to help interpolating generated code, as there the only piece of code that's actually being interpolated is the url.

@helloanoop
Copy link
Contributor

This has been fixed and released in v0.19.0
CLI support has also been released in v0.11.0

@nico-m-64
Copy link
Author

Thanks a lot for the quick fix ! Everything work perfectly 👍
I wish you the best for the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants