dsfdsf23423 2016-01-26 05:39
浏览 65

JWT Token Expiry不一致

I'm still new to laravel, api, as well as JWT. Is there anyone using tymon jwt?

I have been troubling with the Token Expiry. When ever it gets expired, it shows 2 different kinds of errors. Usually, it is just plainly {message: "token_expired"} with a status code of 401, which is fine. But, sometimes it shows up this kind of error, wherein it says it comes from a PayloadValidator, and which I could not trap where I can trigger this. It is a problem for me because its status code is 500 and our frontend developers do not want status code 500.

I would like to make it 400, or rather just have a consistent error response Is there anyone here could help me understand why there 2 kinds of error? How were these encountered?

Occurrence #1: Returns "Status 401 Unauthorized"

{
    "error": "token_expired"
}

Occurrence #2: Returns "Status 500 Internal Server Error"

{
    "message": "Token has expired",
    "status_code": 500,
    "debug": {
    "line": 74,
    "file": "C:\xampp\htdocs\laravel-project\vendor\tymon\jwt-auth\src\Validators\PayloadValidator.php",
    "class": "Tymon\JWTAuth\Exceptions\TokenExpiredException",
    "trace": [
    "#0 C:\xampp\htdocs\laravel-project\vendor\tymon\jwt-auth\src\Validators\PayloadValidator.php(32): Tymon\JWTAuth\Validators\PayloadValidator->validateTimestamps(Array)",
    ....
}

Inconsistent TokenExpiry Response

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度