我在使用标题中的“Authorization: Bearer {token}
”处理身份验证的API中发送标头时遇到了麻烦。
我正在尝试将标头发送为
'Authorization' => $token
$token
变量将根据需要具有授权令牌。
但我得到的结果如下
HTTP_Request2_Response {#319 ▼
#version: "1.1"
#code: 401
#reasonPhrase: "Unauthorized"
我想知道我是否正确发送了Authorization标头。
答案 0 :(得分:0)
尝试使用键x-access-token
答案 1 :(得分:0)
我通过这样传递来解决这个问题
Authentication: Bearer : $token