How to Use HTTP Basic authentication on redmine via a WebXojo app ?

i tried few thing

  • Basic authentication is enable on my redmine
  • API REST is activated

What i tried :

  • MySocket.SetRequestHeader(“Authorization”, "Basic " + EncodeBase64(tLogin.Text + “:” + tPass.Text))
  • aString = MySocket.Post(“http://myredminexyz.com/projects.xml”, 30)
    or
  • MySocket.Get(“http://” + tLogin.Text + “:” + tPass.Text + “@myredminexyz.com/”)

any idea ?

Hi,

MySocket.SetRequestHeader(“Authorization”, "Basic " + EncodeBase64(tLogin.Text + “:” + tPass.Text))

should work.

Try http://user:password@hostname.tld with a browser that you are not logged in to see if basic authentication works.
Or you try it with something like cocoa-rest-client/.

Marius

Thanks Marius for the Cocoa-rest-client ! very useful !
i just found my problem… i used an other port ! oups

You can also use the AuthenticationRequired event to pass the user/password.

I just wanted to add a little note because I was using this to figure out how to call the REST API for WooCommerce. I would recommend setting the line wrap to 0 to ensure the encode64 does not add a line break after 76 characters. I couldn’t figure out why I was getting a 400 bad request.
When I looked at the encoded key, I realized what was happening.

secureSite.SetRequestHeader(“Authorization:”, "Basic " + EncodeBase64( “userkey:userpassword”, 0))