Old Question on Stack Overflow< https://stackoverflow.com/questions/61073325/vba-xml-web-log-in-to-usga-ghin-website-not-working>
USGA Webiste https://www.ghin.com/login Page 2 - USGA https://www.ghin.com/golfer-lookup/following
I built an Excel VBA app that uses the data collected from and API/JSON data-pull from the USGA website, of which I am an authorized USER with a valid account and password. However, the code which I have used reliably for about 2 years is now generating a "Invalid Token Error".
The "Invalid Token Error" may be password related. My prior code required no password input. I have tired to build the password input into the input/response but as of yet no luck?
Any thoughts on you to solve "Invalid Token Error" and possibly, construct the password input on my part? Here is may old code (Also posted on the Stack Overflow links above)
Sub GetInformation()
Const Url = "https://api2.ghin.com/api/v1/public/login.json?"
Dim Http As New XMLHTTP60, ghinNum$, lastName$
ghinNum = "" 'put your ghinNum here
lastName = "" 'put your lastName here
With Http
.Open "GET", Url & "ghinNumber=" & ghinNum & "&lastName=" & lastName & "&remember_me=false", False
.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36"
.setRequestHeader "Referer", "https://www.ghin.com/login"
.send
End With
MsgBox Http.responseText
End Sub