dersiniar Posted March 21, 2022 Posted March 21, 2022 #include "WinHttp.au3" #include <Array.au3> #include <string.au3> #include <MsgBoxConstants.au3> $sDomain = "https://xxxxx.xx/wp-json/wc/v3/products" $sLoginName = "xxxxxxx" $sPassword = "xxxxxxx" $objHTTP = ObjCreate("Msxml2.XMLHTTP.6.0") $objHTTP.open ("GET", $sDomain, False,$sLoginName:$sPassword) $objHTTP.send() $data = $objHTTP.responseText ConsoleWrite($data & @CRLF) And this is error code i get {"code":"woocommerce_rest_cannot_view","message":"Sorry, But you cant view data.","data":{"status":401}} I know its auth error. Can you help me fix how to send auth data right?
dmob Posted March 21, 2022 Posted March 21, 2022 Try $objHTTP.open ("GET", $sDomain, False,$sLoginName & ":" & $sPassword)
dersiniar Posted March 22, 2022 Author Posted March 22, 2022 17 hours ago, dmob said: Try $objHTTP.open ("GET", $sDomain, False,$sLoginName & ":" & $sPassword) Still same result
Zedna Posted March 22, 2022 Posted March 22, 2022 Instead of ObjCreate("Msxml2.XMLHTTP.6.0") Try ObjCreate("Msxml2.XMLHTTP") or ObjCreate("Microsoft.XMLHTTP") or ObjCreate("WinHttp.WinHttpRequest.5.1") Resources UDF ResourcesEx UDF AutoIt Forum Search
Zedna Posted March 22, 2022 Posted March 22, 2022 (edited) Try to encode name:pwd by Base64 encoding $sLoginName & ":" & $sPassword https://en.wikipedia.org/wiki/Basic_access_authentication Edited March 22, 2022 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
Danp2 Posted March 22, 2022 Posted March 22, 2022 @dersiniarHave you researched the issue on the web? For example -- https://stackoverflow.com/questions/42186757/woocommerce-woocommerce-rest-cannot-view-status-401 Latest Webdriver UDF Release Webdriver Wiki FAQs
dersiniar Posted March 23, 2022 Author Posted March 23, 2022 19 hours ago, Danp2 said: @dersiniarHave you researched the issue on the web? For example -- https://stackoverflow.com/questions/42186757/woocommerce-woocommerce-rest-cannot-view-status-401 I know that woocommerce uses Oauth1, I can connect fine with google spreadsheet apis and some others. I just cant figure about how to make successful connection with autoit. Since all api services is with subscription, i need to get one my own. I have some api projects that work in aoutit, just cant get that woocommerce to work
dersiniar Posted March 23, 2022 Author Posted March 23, 2022 20 hours ago, Zedna said: Try to encode name:pwd by Base64 encoding $sLoginName & ":" & $sPassword https://en.wikipedia.org/wiki/Basic_access_authentication I dont understand that part x.x 20 hours ago, Zedna said: Instead of ObjCreate("Msxml2.XMLHTTP.6.0") Try ObjCreate("Msxml2.XMLHTTP") or ObjCreate("Microsoft.XMLHTTP") or ObjCreate("WinHttp.WinHttpRequest.5.1") i had ("WinHttp.WinHttpRequest.5.1") before, i tested them all, same result.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now