headzoo / surf

Stateful programmatic web browsing in Go.
MIT License
1.49k stars 160 forks source link

AddRequestHeader not working #120

Open anisbhsl opened 4 years ago

anisbhsl commented 4 years ago

I am trying to do basic auth using authorization header. However, during URL request surf is not attaching the header with the request. I did following:

browser.AddRequestHeader("Authorization","Basic "+base64encodedstring)
browser.Open(url)
browser.StatusCode() //throwing 401 
s0kil commented 3 years ago

@headzoo Could you provide some insight? How could we login into a website requesting basic auth?

@anisbhsl Did you manage to figure it out?

anisbhsl commented 3 years ago

@s0kil I had to make custom changes in this library to make it work. You need to intercept the request maker (though need to hardcode authorization token there), but I managed to solve it that way.

s0kil commented 3 years ago

My problem was that I was trying to use basic auth to login, but the server wants digest authentication.