Livecode httpHeader

时间:2018-04-05 02:56:06

标签: authentication post request http-headers livecode

有人可以指导我下面发送httpHeaders的适当方式。我得到了'#34;权限被拒绝"从服务器响应,但我的代码看起来都很好。

put "ABCD" into clientId
put "1234" into clientSecret

put "Authorization: Basic" && base64Encode("clientId:clientSecret") && "Content-Type: application/json"&& "Cache-Control: no-cache"  into tHeader 
set the httpHeaders to tHeader

 post receiveMomoRequest to url "https://server/v1/merchantaccount/merchants/HMXXXXXX/receive"

1 个答案:

答案 0 :(得分:1)

每个标题字段应该在一个单独的行上,因此您应该在每个键值之间添加一个返回值:

put "ABCD" into clientId
put "1234" into clientSecret

put "Authorization: Basic" && base64Encode("clientId:clientSecret") & return & "Content-Type: application/json" & return & "Cache-Control: no-cache"  into tHeader 
set the httpHeaders to tHeader

post receiveMomoRequest to url    "https://server/v1/merchantaccount/merchants/HMXXXXXX/receive"