Been stuck on this for a few days now. Trying to obtain access token from an API with oauth2 authentication.
But I keep getting '401 Unauthorized', "Full authentication is required'
My gues is i'm doing something wrong with the
.SetRequestHeder "Authorization", "basic " + (base64 encoded)
Here's the code so far: (worked with another API)
Username = "myusername"
Password = "myclientsecret"
PasswordnUsername = Password & ":" & Username
argumentString = "?grant_type=password&username=myusername&password=mypassword"
Set xmlhttp = CreateObject("MSXML2.XMLHTTP.6.0")
xmlhttp.Open "POST", "https://api.url/partner/oauth/token", False
xmlhttp.SetRequestHeader "Authorization", "basic " + mdl_API_MB_ACCESS_TOKEN.Base64Encode(PasswordnUsername)
xmlhttp.SetRequestHeader "x-api-key", "myxapicode"
xmlhttp.Send (argumentString)