Hi, I still don't have a full solution of using VBA to refresh the token but I have made some progress in that I connect to the server but it returns an error message "Authorization has been denied for this request.". I've checked all of the necessary credentials and they are correct. If there's anyone out there who has knowledge of both VBA and refresh token procedure, I'd be deeply grateful if you could look at the VBA code below to see if there's anything obviously wrong:-
Sub RefreshToken()
Dim hReq As Object, json As Dictionary
Dim sht As Worksheet
Dim strUrl As String
Set sht = Sheet1
strUrl = Cells(1, 5).value 'Variable text held in this cell
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
RonAnderson
Hi, I still don't have a full solution of using VBA to refresh the token but I have made some progress in that I connect to the server but it returns an error message "Authorization has been denied for this request.". I've checked all of the necessary credentials and they are correct. If there's anyone out there who has knowledge of both VBA and refresh token procedure, I'd be deeply grateful if you could look at the VBA code below to see if there's anything obviously wrong:-
Sub RefreshToken()
Dim hReq As Object, json As Dictionary
Dim sht As Worksheet
Dim strUrl As String
Set sht = Sheet1
strUrl = Cells(1, 5).value 'Variable text held in this cell
Set hReq = CreateObject("MSXML2.XMLHTTP")
With hReq
.Open "GET", strUrl, False
.SetRequestHeader "Authorization", "Basic Base64Encode"
.SetRequestHeader "Content_Type", "application/x-www-form-urlencoded"
.SetRequestHeader "grant_type", "refresh_token"
.SetRequestHeader "refresh_token", “MyRefreshToken”
.Send 'CreateRefreshRequest()
End With
Response = hReq.ResponseText
‘//Do other things here
End Sub
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.