figtrees15 avatar image
figtrees15 asked

internal Server Error getting oauth token

I am using VBA in an MS-Access database, I can get the authorization code with expiry time of 299 but when I try to get the access token, I get an 500 internal Server error returned in xmlHTTP.status and StatusText with and empty responseText.

Any advice greatly appreciated.

Code below:

' Get User Access token

strContentType = "application/x-www-form-urlencoded"

strClientID = strApp_ID

strClientSecret = strCert_ID

Dim strData As String

strData = "grant_type=authorization_code" & _

"code=" & strAuthorization_Code & _

"redirect_uri=" & strRedirect_uri

Dim xmlHTTP As New MSXML2.XMLHTTP60, myuri As String

myuri = strEndPoint

xmlHTTP.Open "POST", strEndPoint, False

xmlHTTP.setRequestHeader "Content-Type", "text/json"

xmlHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

xmlHTTP.setRequestHeader "User-Agent", "Mozilla/5.0"

xmlHTTP.setRequestHeader "Authorization", "Basic " + EncodeBase64(strClientID & ":" & strClientSecret)

xmlHTTP.Send strData

MsgBox (xmlHTTP.Status & " : " & xmlHTTP.StatusText)

MsgBox (xmlHTTP.responseText)

tokenoauth2internal server errorauth-token500 server error500 internal
10 |600

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers