0

我正在尝试获取 current_user 但非用户通过 API 请求的标头进行身份验证。标头 include access-token,但它不进行身份验证并显示以下错误clientuid

供参考,请检查此回购

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'
4

1 回答 1

0

缺少访问令牌到期的请求

实际请求是

curl --location --request GET 'http://localhost:3000/tweets' \
--header 'Content-Type: application/json' \
--header 'client: TeS-DWwybwxqh9l3ZMn__A' \
--header 'uid: sahsantoshh@gmail.com' \
--header 'expiry: 1616149988' \
--header 'access-token: sjdinlkiijklnlaosihda' \
于 2021-03-05T11:01:47.120 回答