I am trying create a VBA tool in Excel to insert data into a AGOL Feature layer. When I request a token via VBA it ends with .. and is 106 characters shorter than the token generated by the AGOL query tool. when I try to use the token I request I get and "invalid token" error. But if I copy the AGOL generated token and paste it into my code my query works fine. It looks like the VBA requested token is cut off.
Anyone else run into this?
Thanks
Larry
A snippet of my code:
Dim tokenHTTP As Object
Set tokenHTTP = CreateObject("MSXML2.ServerXMLHTTP")
Dim tokenJSON As String
Dim tokenURL As String
tokenURL = "https://www.arcgis.com/sharing/rest/generateToken?f=json&username=MyuserName&password=MyPassword&client=requestip&expiration=1"
tokenHTTP.Open "POST", tokenURL, False
tokenHTTP.setRequestHeader "Content-type", "application/json"
tokenHTTP.send (tokenJSON)
Debug.Print tokenHTTP.responseText