-
1
- #1
Olaf Doschke
Programmer
I recently tried an API, which required basic auth (safely via https), but didn't work with the user/password parameters of the open method of MSXML2.XMLHTTP.
Wikipedia to the rescue, look at
You get the description of what header to set client side:
There's one tricky hurdle:
[tt]Strconv("Aladdin:OpenSesame",13)[/tt] nicely turns to the sample base64 encoding QWxhZGRpbjpPcGVuU2VzYW1l, but that's generally not enough. When the [tt]userassword[/tt] string length is not a multiple of 3. the "=" VFP correctly uses to pad the base64 representation is not valid in the http request header, thus the removal of "=".
In respect of the user/password parameters of the open method I don't find how they are really used for which type of authentication, maybe it's also just a limitation of the one API I used, which was the desk.com API of the salesforce help desk.
Bye, Olaf.
Wikipedia to the rescue, look at
You get the description of what header to set client side:
Code:
o = CreateObject("msxml2.xmlhttp")
o.open("GET","[URL unfurl="true"]https://apiurl...")[/URL]
[b]lcBasicAuth = "Basic " + Chrtran(Strconv(cUser+":"+cPassword,13),"=","")
o.setRequestHeader("Authorization",lcBasicAuth)[/b]
o.send()
...
There's one tricky hurdle:
[tt]Strconv("Aladdin:OpenSesame",13)[/tt] nicely turns to the sample base64 encoding QWxhZGRpbjpPcGVuU2VzYW1l, but that's generally not enough. When the [tt]userassword[/tt] string length is not a multiple of 3. the "=" VFP correctly uses to pad the base64 representation is not valid in the http request header, thus the removal of "=".
In respect of the user/password parameters of the open method I don't find how they are really used for which type of authentication, maybe it's also just a limitation of the one API I used, which was the desk.com API of the salesforce help desk.
Bye, Olaf.