clansty / Q2TG

QQ 与 Telegram 群相互转发的 bot
https://t.me/Q2TGbot
GNU Affero General Public License v3.0
757 stars 77 forks source link

TG内验证码过期问题 #76

Closed Nanawwa closed 4 weeks ago

Nanawwa commented 1 year ago

完整日志如下 已经确认过api_id与api_hash正确 但是始终无法获取最后一步验证码

Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "db_name", schema "public" at "postgres:5432"

🚀  Your database is now in sync with your Prisma schema. Done in 177ms

✔ Generated Prisma Client (4.2.1 | library) to ./node_modules/@prisma/client in 
213ms

[2022-12-22T06:10:37.717] [DEBUG] Instance - 0 - 正在登录 TG Bot
[2022-12-22T06:10:37.720] [INFO] - [Running gramJS version 2.9.4]
[2022-12-22T06:10:37.735] [DEBUG] TelegramSession - bot:0 - Session 不存在,创建
[2022-12-22T06:10:46.478] [INFO] Instance - 0 - TG Bot 登录完成
[2022-12-22T06:10:46.479] [INFO] Instance - 0 - 当前服务器未配置,请向 Bot 发送 /setup 来设置
[2022-12-22T06:22:16.491] [INFO] SetupService - 0 - 用户 ID: ******成为了 Bot 主人
[2022-12-22T06:22:34.132] [MARK] [iPad:2015065305] - ----------
[2022-12-22T06:22:34.133] [MARK] [iPad:2015065305] - Package Version: oicq@2.3.1 (Released on 2022/6/21)
[2022-12-22T06:22:34.133] [MARK] [iPad:2015065305] - View Changelogs:https://github.com/takayama-lily/oicq/releases
[2022-12-22T06:22:34.133] [MARK] [iPad:2015065305] - ----------
[2022-12-22T06:22:34.242] [MARK] [iPad:2015065305] - ******:8080 connected
[2022-12-22T06:23:03.005] [MARK] [iPad:******] - Welcome, ****** ! 正在加载资源...
[2022-12-22T06:23:03.449] [MARK] [iPad:******] - 加载了234个好友,105个群,0个陌生人
[2022-12-22T06:23:09.142] [INFO] - [Running gramJS version 2.9.4]
[2022-12-22T06:23:09.145] [DEBUG] TelegramSession - user:0 - Session 不存在,创建
[2022-12-22T06:23:17.449] [ERROR] Main - UnhandledException:  Error: Auth key unset
    at MTProtoState.encryptMessageData (/app/node_modules/telegram/network/MTProtoState.js:142:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async MTProtoSender._sendLoop (/app/node_modules/telegram/network/MTProtoSender.js:298:20)
Nanawwa commented 1 year ago

尝试更换账号 可以收到验证码,但是填入后后台报过期验证码,多次重试也是如此。 image image

Yubainc commented 1 year ago

同样的问题,报过期验证码

image

[2022-12-25T09:54:43.498] [ERROR] SetupService - 0 - RPCError: 400: PHONE_CODE_EXPIRED (caused by auth.SignIn)
      at RPCMessageToError (/app/node_modules/telegram/errors/index.js:28:12)
      at MTProtoSender._handleRPCResult (/app/node_modules/telegram/network/MTProtoSender.js:485:58)
      at MTProtoSender._processMessage (/app/node_modules/telegram/network/MTProtoSender.js:410:15)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)
      at async MTProtoSender._recvLoop (/app/node_modules/telegram/network/MTProtoSender.js:386:17) {
code: 400,
errorMessage: 'PHONE_CODE_EXPIRED'

会不会是弹出验证码输入窗口时会选中输入框的问题

image

chiyuki0325 commented 1 year ago

图片 分遗产分遗产

magisk317 commented 1 year ago

前几次报验证码不对的错,后来重试多了直接FLOOD让等几百秒到几千秒不等。。。。

image

Puqns67 commented 1 year ago

同问题

Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "Q2TG", schema "public" at "172.17.0.1:5432"

The database is already in sync with the Prisma schema.

✔ Generated Prisma Client (4.2.1 | library) to ./node_modules/@prisma/client in 
111ms

[2023-01-02T14:24:26.014] [DEBUG] Instance - 0 - 正在登录 TG Bot
[2023-01-02T14:24:26.016] [INFO] - [Running gramJS version 2.9.4]
[2023-01-02T14:24:34.029] [INFO] Instance - 0 - TG Bot 登录完成
[2023-01-02T14:24:34.029] [INFO] Instance - 0 - 当前服务器未配置,请向 Bot 发送 /setup 来设置
[2023-01-02T14:25:02.455] [INFO] SetupService - 0 - 用户 ID: XXXXXXXXX 成为了 Bot 主人
[2023-01-02T14:26:17.980] [MARK] [aPad:XXXXXXXXXX] - ----------
[2023-01-02T14:26:17.981] [MARK] [aPad:XXXXXXXXXX] - Package Version: oicq@2.3.2-clansty (Released on 2022/12/23)
[2023-01-02T14:26:17.981] [MARK] [aPad:XXXXXXXXXX] - View Changelogs:https://github.com/takayama-lily/oicq/releases
[2023-01-02T14:26:17.981] [MARK] [aPad:XXXXXXXXXX] - ----------
[2023-01-02T14:26:18.041] [MARK] [aPad:XXXXXXXXXX] - 198.18.0.20:8080 connected
[2023-01-02T14:26:18.508] [MARK] [aPad:XXXXXXXXXX] - Welcome, Σ(゚Д゚) ! 正在加载资源...
[2023-01-02T14:26:18.963] [MARK] [aPad:XXXXXXXXXX] - 加载了99个好友,34个群,0个陌生人
[2023-01-02T14:26:46.356] [INFO] - [Running gramJS version 2.9.4]
[2023-01-02T14:26:46.359] [DEBUG] TelegramSession - user:0 - Session 不存在,创建
[2023-01-02T14:26:54.792] [ERROR] Main - UnhandledException:  Error: Auth key unset
    at MTProtoState.encryptMessageData (/app/node_modules/telegram/network/MTProtoState.js:142:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async MTProtoSender._sendLoop (/app/node_modules/telegram/network/MTProtoSender.js:298:20)
[2023-01-02T14:28:11.906] [ERROR] SetupService - 0 - RPCError: 400: PHONE_CODE_EXPIRED (caused by auth.SignIn)
    at RPCMessageToError (/app/node_modules/telegram/errors/index.js:28:12)
    at MTProtoSender._handleRPCResult (/app/node_modules/telegram/network/MTProtoSender.js:485:58)
    at MTProtoSender._processMessage (/app/node_modules/telegram/network/MTProtoSender.js:410:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async MTProtoSender._recvLoop (/app/node_modules/telegram/network/MTProtoSender.js:386:17) {
  code: 400,
  errorMessage: 'PHONE_CODE_EXPIRED'
}
[2023-01-02T14:28:55.778] [ERROR] SetupService - 0 - RPCError: 400: PHONE_CODE_EXPIRED (caused by auth.SignIn)
    at RPCMessageToError (/app/node_modules/telegram/errors/index.js:28:12)
    at MTProtoSender._handleRPCResult (/app/node_modules/telegram/network/MTProtoSender.js:485:58)
    at MTProtoSender._processMessage (/app/node_modules/telegram/network/MTProtoSender.js:410:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async MTProtoSender._recvLoop (/app/node_modules/telegram/network/MTProtoSender.js:386:17) {
  code: 400,
  errorMessage: 'PHONE_CODE_EXPIRED'
}
Yuaaaaaan commented 1 year ago

我也遇到了无法登录的问题,不知道为什么输入了tg验证码一直都登不上,输入了很多次都不行,log一直说验证码过期 2023-01-02T16:21:47.112] [ERROR] SetupService - 0 - RPCError: 400: PHONE_CODE_EXPIRED (caused by auth.SignIn) at RPCMessageToError (/app/node_modules/telegram/errors/index.js:28:12) at MTProtoSender._handleRPCResult (/app/node_modules/telegram/network/MTProtoSender.js:485:58) at MTProtoSender._processMessage (/app/node_modules/telegram/network/MTProtoSender.js:410:15) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async MTProtoSender._recvLoop (/app/node_modules/telegram/network/MTProtoSender.js:386:17) { code: 400, errorMessage: 'PHONE_CODE_EXPIRED' }

ERR0RPR0MPT commented 1 year ago

一样的问题,更换了两个服务器也无法解决问题。

[2023-01-03T20:20:05.809] [ERROR] SetupService - 0 - RPCError: 400: PHONE_CODE_EXPIRED (caused by auth.SignIn)
    at RPCMessageToError (/app/node_modules/telegram/errors/index.js:28:12)
    at MTProtoSender._handleRPCResult (/app/node_modules/telegram/network/MTProtoSender.js:485:58)
    at MTProtoSender._processMessage (/app/node_modules/telegram/network/MTProtoSender.js:410:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async MTProtoSender._recvLoop (/app/node_modules/telegram/network/MTProtoSender.js:386:17) {
  code: 400,
  errorMessage: 'PHONE_CODE_EXPIRED'
}
ERR0RPR0MPT commented 1 year ago

一样的问题,更换了两个服务器也无法解决问题。

[2023-01-03T20:20:05.809] [ERROR] SetupService - 0 - RPCError: 400: PHONE_CODE_EXPIRED (caused by auth.SignIn)
    at RPCMessageToError (/app/node_modules/telegram/errors/index.js:28:12)
    at MTProtoSender._handleRPCResult (/app/node_modules/telegram/network/MTProtoSender.js:485:58)
    at MTProtoSender._processMessage (/app/node_modules/telegram/network/MTProtoSender.js:410:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async MTProtoSender._recvLoop (/app/node_modules/telegram/network/MTProtoSender.js:386:17) {
  code: 400,
  errorMessage: 'PHONE_CODE_EXPIRED'
}

经过一段时间的研究,发现此问题是 Telegram 对验证码检查做了升级,貌似也会检查目前 q2tg 的使用内联键盘输入验证码的方案?总之,可以通过以下的解决方案临时解决该问题。

临时解决方案

下载修改版本代码

假设 /root/q2tg 为运行目录,将文件解压到 /root/q2tg/SetupService.js

Snipaste_2023-01-04_09-04-06

删除所有已经构建好的容器:docker-compose down

修改 docker-compose.yaml,在 q2tg 的 volumn 中添加一行:

- ./SetupService.js:/app/build/services/SetupService.js

例如:

q2tg:
    ...

    volumes:
          - ./data:/app/data
          - ./SetupService.js:/app/build/services/SetupService.js

使用 docker-compose up -d 构建容器。

成功后,使用 docker exec -it q2tg /bin/sh 进入容器,之后执行 yarn start ,这时不要关闭 Shell 窗口。

此时会弹出 /setup 安装提示,在 Telegram 客户端上按照提示正常登录 QQ,一直到登录 TG UserBot 并需要接收验证码时,

如图所示:

Snipaste_2023-01-04_09-09-35

此时回到 Shell 窗口,输入获取到的验证码,回车。

Snipaste_2023-01-04_09-58-06

之后再输入两次验证密码就可以成功登录了。

@HiyoriTUK @Puqns67 @lteyox @YidaozhanYa @magisk317 @Yuaaaaaan