Jump to content
  • 0

Get Redresh Token Using VBA


RonAnderson

Question

Hi, I have an Excel application which uses extensive VBA. I'm able to seamlessly download data from my Caspio database and place it on to my spreadsheet but the next day I have to renew the token. I know there's a method of refreshing the token automatically and here is where I'm stuck. Does anyone have experience of VBA code and how this can be written using credentials held in ARC REST API Client?

Here's the coded I'm trying to use:-

Sub GetRefreshToken()
Dim getTokenUrl As String

getTokenUrl = "https://xxxxxxxxx.caspio.com/oauth/token&code=" & "&client_id=myCLIENTstring&client_secret=myCLIENTsecret"

authKey = "originaltoken"

Dim Http As MSXML2.XMLHTTP60
Set Http = CreateObject("MSXML2.XMLHTTP.6.0")

With Http
    .Open "GET", getTokenUrl, False
    .setRequestHeader "Content-Type", "Bearer " & authKey
    .send ("")
End With
Do While Http.readyState <> 4
Loop

Response = Http.responseText

End Sub
 

Kind regards, Ron

Link to comment
Share on other sites

1 answer 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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...