refresh token

1 post / 0 new
kanm
refresh token

Hi I get a security invalid message when I use the below code to refresh my security token in Excel. Is there anything missing from it? I am already logged in and able to use other code for pulling market details using the same security token (m_accountToken) that I am trying to refresh.

Call oXMLHTTP.Open("POST", IG_API_HOST + "/session/refresh-token", False)

Dim requestBodyDictionary As Dictionary
Set requestBodyDictionary = New Dictionary

Call requestBodyDictionary.Add("refresh_token", m_accountToken)

Dim requestBodyString As Variant
requestBodyString = JSON.toString(requestBodyDictionary)

Call oXMLHTTP.SetRequestHeader("Content-Type", "application/json; charset=utf-8")
Call oXMLHTTP.SetRequestHeader("Accept", "application/json; charset=utf-8")
Call oXMLHTTP.SetRequestHeader("X-IG-API-KEY", m_apiKey)
Call oXMLHTTP.SetRequestHeader("version", "1")

Call oXMLHTTP.Send(requestBodyString)

Dim responseData As Dictionary
Set responseData = JSON.parse(oXMLHTTP.responsetext)

If oXMLHTTP.Status = 200 Then
refreshtoken = responseData.Item("refresh_token")
Else
MsgBox oXMLHTTP.responsetext
refreshtoken = ""
End If