我正在尝试获取 current_user 但非用户通过 API 请求的标头进行身份验证。标头 include access-token
,但它不进行身份验证并显示以下错误client
:uid
供参考,请检查此回购
Filter chain halted as :authenticate_user! rendered or redirected
Completed 401 Unauthorized in 398625ms (Views: 0.3ms | ActiveRecord: 2.6ms | Allocations: 1598457)
回复:
{
"errors": [
"You need to sign in or sign up before continuing."
]
}
请求配置文件,演示端点
curl --location --request GET 'http://localhost:3000/tweets' \
--header 'client: TeS-DWwybwxqh9l3ZMn__A' \
--header 'uid: sahsantoshh@gmail.com' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer e1tO5DawJq0iISdsgOk-fg'