Good day!
I am very new to B4a, and I am trying to get a token from my colleague's API. Below are the sample parameters, and the error I encountered. Your help is very much appreciated.
Acquire CSRF
GET Parameters:
URL:
https://xxxxxxxxxxx.ph/api/user/csrf
Key: apiKey
Value: xxxxxxxxxx
Dim j As HttpJob
j.Initialize("", Me)
j.Download("https://xxxxxxxxxxx.ph/api/user/csrf")
j.GetRequest.SetHeader("Authorization", "Basic Og==")
j.GetRequest.SetHeader("apiKey", "xxxxxxxxxx")
Wait For (j) JobDone (j As HttpJob)
If j.Success Then
Dim jp As JSONParser
jp.Initialize(j.GetString)
Log(jp)
Else
Log("Error: " & j.ErrorMessage)
End If
j.Release
ERROR
Logger connected to: HUAWEI STK-L22
--------- beginning of system
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
ResponseError. Reason: , Response: {"status":false,"error":"Set API Key in Request Header"}
Error: {"status":false,"error":"Set API Key in Request Header"}