#Using MS Access/VBA. Getting Authorization Header Errors.
1 messages · Page 1 of 1 (latest)
Issue seems to be in this function, but ChatGPT can't find the error: '''Private Function SendRequest(ByVal URL As String, ByVal method As String, ByVal requestBody As String) As String
Dim http As Object
Set http = CreateObject("MSXML2.ServerXMLHTTP.6.0")
http.Open method, URL, False
http.setRequestHeader "Content-Type", "application/json"
http.setRequestHeader "x-api-key", apiKey
http.setRequestHeader "Authorization", "Bearer " & GetToken()
If method = "POST" Then
http.send requestBody
Else
http.send
End If
SendRequest = http.responseText
End Function '''
you put x-api-key instead of xi-api-key
and iunno about the authorization header
not sure that's even required
Sweet! I never would have caught that xi. I will try it again tomorrow
That missing "i" might have been an issue, but there's something else at play because I get that same error message: Response: {"detail":{"status":"invalid_authorization_header","message":"authorization header must start with 'Bearer ', got Bearer"}} .