I had some trouble getting basic HTTP authentication to work with the Dispatch library. The documentation and message posts that I've seen say to use the .as(username, password) function on the HTTP request. However, this did not work for me. I had to use the as_! function instead of as. Example:
I believe using as will make a request without authentication, look for a 401 response header, and then re-issue the request with authentication. The Github API, and many others I imagine, do not send a 401 response back when not authenticated.
3 comments:
Thank you so much for this! Saved me at least a day.
Thx!!! It was very helpful for me! =)
Thank you so much mate!
Saved me a whole lot of trouble
Post a Comment