Auto_Bangumi icon indicating copy to clipboard operation
Auto_Bangumi copied to clipboard

[错误报告] JWT Token 过期时不掉登录态,导致重复自动刷新

Open tixwho opened this issue 1 year ago • 0 comments

确认

  • [X] 我的版本是最新版本,我的版本号与 version 相同。
  • [X] 我已经查阅了已知问题,并确认我的问题不在其中。
  • [X] 我已经 issue 中搜索过,确认我的问题没有被提出过。
  • [X] 我已经修改标题,将标题中的 描述 替换为我遇到的问题。

当前程序版本

3.1.12

问题类型

WebUI

问题描述

登录正常。正常运行一段时间(通常为几天)后,再次打开WebUI无需登录,但框架内会浮现内容为空的错误提示框,内容刷不出来。

手动将所有站点cookie删除后,重新登录可以暂时解决问题。

发生问题时系统日志

[2024-02-13 20:21:04] INFO:     Started server process [7]
[2024-02-13 20:21:04] INFO:     Waiting for application startup.
[2024-02-13 20:21:04] INFO:     
[2024-02-13 20:21:04] INFO:                     _        ____                                    _
[2024-02-13 20:21:04] INFO:          /\        | |      |  _ \                                  (_)
[2024-02-13 20:21:04] INFO:         /  \  _   _| |_ ___ | |_) | __ _ _ __   __ _ _   _ _ __ ___  _
[2024-02-13 20:21:04] INFO:        / /\ \| | | | __/ _ \|  _ < / _` | '_ \ / _` | | | | '_ ` _ \| |
[2024-02-13 20:21:04] INFO:       / ____ \ |_| | || (_) | |_) | (_| | | | | (_| | |_| | | | | | | |
[2024-02-13 20:21:04] INFO:      /_/    \_\__,_|\__\___/|____/ \__,_|_| |_|\__, |\__,_|_| |_| |_|_|
[2024-02-13 20:21:04] INFO:                                                 __/ |
[2024-02-13 20:21:04] INFO:                                                |___/
[2024-02-13 20:21:04] INFO:     Version 3.1.12  Author: EstrellaXD Twitter: https://twitter.com/Estrella_Pan
[2024-02-13 20:21:04] INFO:     GitHub: https://github.com/EstrellaXD/Auto_Bangumi/
[2024-02-13 20:21:04] INFO:     Starting AutoBangumi...
[2024-02-13 20:21:04] INFO:     Config loaded
[2024-02-13 20:21:04] INFO:     Program running.
[2024-02-13 20:21:04] INFO:     Application startup complete.
[2024-02-13 20:21:04] INFO:     Uvicorn running on http://0.0.0.0:7892 (Press CTRL+C to quit)
[2024-02-13 20:21:09] INFO:     Config loaded
[2024-02-13 20:21:09] INFO:     Program running.
[2024-02-13 20:32:11] INFO:     [LoliHouse] Chiyu Mahou no Machigatta Tsukaikata - 06 [WebRip 1080p HEVC-10bit AAC ASSx2].mkv >> Chiyu Mahou no Machigatta Tsukaikata S01E06.mkv
[2024-02-13 20:35:11] INFO:     [LoliHouse] Sasaki to P-chan - 06 [WebRip 1080p HEVC-10bit AAC ASSx2].mkv >> Sasaki to P-chan S01E06.mkv
[2024-02-13 20:39:11] INFO:     [Nekomoe kissaten&LoliHouse] Dungeon Meshi - 06 [WebRip 1080p HEVC-10bit AAC EAC3 ASSx2].mkv >> Dungeon Meshi S01E06.mkv
[2024-02-13 20:41:12] INFO:     [Nekomoe kissaten&LoliHouse] Saijaku Tamer wa Gomi Hiroi no Tabi wo Hajimemashita - 04 [WebRip 1080p HEVC-10bit AAC ASSx2].mkv >> Saijaku Tamer wa Gomi Hiroi no Tabi wo Hajimemashita S01E04.mkv
[2024-02-14 14:46:43] ERROR     Exception in ASGI application
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 428, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/uvicorn/middleware/message_logger.py", line 86, in __call__
    raise exc from None
  File "/usr/lib/python3.11/site-packages/uvicorn/middleware/message_logger.py", line 82, in __call__
    await self.app(scope, inner_receive, inner_send)
  File "/usr/lib/python3.11/site-packages/fastapi/applications.py", line 282, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/lib/python3.11/site-packages/starlette/applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/lib/python3.11/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/usr/lib/python3.11/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/usr/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
    raise exc
  File "/usr/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "/usr/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__
    raise e
  File "/usr/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__
    await self.app(scope, receive, send)
  File "/usr/lib/python3.11/site-packages/starlette/routing.py", line 718, in __call__
    await route.handle(scope, receive, send)
  File "/usr/lib/python3.11/site-packages/starlette/routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "/usr/lib/python3.11/site-packages/starlette/routing.py", line 66, in app
    response = await func(request)
               ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/fastapi/routing.py", line 231, in app
    solved_result = await solve_dependencies(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/fastapi/dependencies/utils.py", line 622, in solve_dependencies
    solved = await call(**sub_values)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/module/security/api.py", line 17, in get_current_user
    payload = verify_token(token)
              ^^^^^^^^^^^^^^^^^^^
  File "/app/module/security/jwt.py", line 50, in verify_token
    raise JWTError("Token expired")
jose.exceptions.JWTError: Token expired
[2024-02-14 14:46:43] ERROR     Exception in ASGI application
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 428, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/uvicorn/middleware/message_logger.py", line 86, in __call__
    raise exc from None
  File "/usr/lib/python3.11/site-packages/uvicorn/middleware/message_logger.py", line 82, in __call__
    await self.app(scope, inner_receive, inner_send)
  File "/usr/lib/python3.11/site-packages/fastapi/applications.py", line 282, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/lib/python3.11/site-packages/starlette/applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/lib/python3.11/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/usr/lib/python3.11/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/usr/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
    raise exc
  File "/usr/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "/usr/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__
    raise e
  File "/usr/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__
    await self.app(scope, receive, send)
  File "/usr/lib/python3.11/site-packages/starlette/routing.py", line 718, in __call__
    await route.handle(scope, receive, send)
  File "/usr/lib/python3.11/site-packages/starlette/routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "/usr/lib/python3.11/site-packages/starlette/routing.py", line 66, in app
    response = await func(request)
               ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/fastapi/routing.py", line 231, in app
    solved_result = await solve_dependencies(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/fastapi/dependencies/utils.py", line 622, in solve_dependencies
    solved = await call(**sub_values)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/module/security/api.py", line 17, in get_current_user
    payload = verify_token(token)
              ^^^^^^^^^^^^^^^^^^^
  File "/app/module/security/jwt.py", line 50, in verify_token
    raise JWTError("Token expired")
jose.exceptions.JWTError: Token expired


....重复若干次直至清除cookie重新登录获取JWT Token

tixwho avatar Feb 14 '24 22:02 tixwho