wechaty / puppet-wechat4u

Wechat4u Puppet for Wechaty
https://www.npmjs.com/package/wechaty-puppet-wechat4u
Apache License 2.0
99 stars 34 forks source link

Unable to login to wechat4u (web) via QR code #38

Open jwwang2003 opened 2 years ago

jwwang2003 commented 2 years ago

Important:Please file the issue follow the template, or we won't be able to help you to solve the problem.

0. Report Issue Guide

  1. Please run the following command and check whether the problem has been fixed:

    WECHATY_LOG=verbose nodemon -w room-bot.js room-bot.js
  2. Please search in FAQ List first, and make sure your problem has not been solved before.

  3. Please search in the issue first, and make sure your problem had not been reported before

1. Versions

What is your wechaty version?

Answer: 0.56.6

Which puppet are you using for wechaty? (puppeteer/padlocal/service...)

Answer: "wechaty-puppet-wechat4u"

What is your wechaty-puppet-XXX(padchat/puppeteer/) version?

Answer: 0.17.4

What is your node version? (run node --version)

Answer : v14.18.1

What os are you using

Answer: CodeSandbox (linux?)

2. Describe the bug

My WeChat account is created before 2017 and is on the WeiXin server, not the international Wechat version. When I try to login to the web version of WeChat (web.wechat.com), I don't get any errors but the website tells me

"提示 For the security of your account, you cannot log in to WeChat for Web via this WeChat ID. You can go to the website https://weixin.qq.com/ to download the WeChat app and log in."

Upon trying the same procedure using Wechaty, I get the following error in the console after scanning the QR code.

https://login.weixin.qq.com/l/gfRUmSKY3A==
[3] Scan QR Code in above url to login:
00:02:09 VERB PuppetWechat4u monkeyPatchOffState(checkLogin) funcNew()
00:02:12 VERB PuppetWechat4u monkeyPatchOffState(login) funcNew()
00:02:13 VERB PuppetWechat4u monkeyPatchOffState(_init) funcNew()
00:02:15 INFO Bot error: Error: 1 == 0
00:02:15 VERB MemoryCard <puppet> delete(PUPPET-WECHAT4U)
00:02:15 VERB MemoryCard <room-bot> save() to StorageFile</sandbox/room-bot.memory-card.json>
00:02:15 VERB StorageFile save() to /sandbox/room-bot.memory-card.json

3. To Reproduce

This part is very important: if you can not provide any reproduce steps, then the problem will be very hard to be recognized.

How to create a Minimal, Reproducible Example

Steps to reproduce the behavior:

image

4. Expected behavior

Give a clear and concise description of what you expected to happen.

5. Actual behavior

If applicable, add screenshots to help explain your problem. But the log message must be in plain text instead of screenshot.

6. Full Output Logs

Set env WECHATY_LOG=silly in order to set log level to silly, then we can get the full log (If you dosen't set log env, log level is info as default, we cannot get the full log)

 WARN lifecycle The node binary used for scripts is /tmp/yarn--1646266467862-0.3395678214724689/node but npm is using /home/sandbox/.nvm/versions/node/v14.18.1/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> wechaty-room-bot@1.0.0 bot /sandbox
> WECHATY_LOG=verbose nodemon -w room-bot.js room-bot.js

[nodemon] 2.0.7
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): room-bot.js
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node room-bot.js`
00:14:40 INFO Config registering process.on("unhandledRejection") for development/debug
00:14:40 VERB Config constructor()

=============== Powered by Wechaty ===============
-------- https://github.com/Chatie/wechaty --------
Hello,
I'm a Wechaty Botie with the following super powers:
1. Find a room
2. Add people to room
3. Del people from room
4. Change room topic
5. Monitor room events
6. etc...
If you send a message of magic word 'ding',
you will get a invitation to join my own room!
__________________________________________________
Hope you like it, and you are very welcome to
upgrade me for more super powers!
Please wait... I'm trying to login in...

00:14:40 VERB Wechaty constructor()
00:14:40 VERB StateSwitch constructor(Wechaty, "{"log":{"enableTimestamp":true,"logLevel":4,"prefixFilter":{}}}")
00:14:40 VERB StateSwitch constructor(WechatyReady, "{"log":{"enableTimestamp":true,"logLevel":4,"prefixFilter":{}}}")
00:14:40 VERB Wechaty on(scan, listener) registering... listenerCount: 0
00:14:40 VERB Wechaty on(logout, listener) registering... listenerCount: 0
00:14:40 VERB Wechaty on(error, listener) registering... listenerCount: 0
00:14:40 VERB Wechaty on(login, listener) registering... listenerCount: 0
00:14:40 VERB Wechaty on(room-join, listener) registering... listenerCount: 0
00:14:40 VERB Wechaty on(room-leave, listener) registering... listenerCount: 0
00:14:40 VERB Wechaty on(room-topic, listener) registering... listenerCount: 0
00:14:40 VERB Wechaty on(message, listener) registering... listenerCount: 0
00:14:40 VERB Wechaty <wechaty-puppet-wechat4u>(room-bot) start() v0.56.6 is starting...
00:14:40 VERB Wechaty id: cl0a8k2by00004rel9ovv4ks3
00:14:40 VERB StateSwitch <WechatyReady> off(true) <- (true)
00:14:40 VERB StateSwitch <Wechaty> on(pending) <- (false)
00:14:40 VERB MemoryCard constructor("room-bot")
00:14:40 VERB MemoryCard getStorage() for storage type: N/A
00:14:40 VERB getStorage name: room-bot, options: {"type":"file"}
00:14:40 VERB StorageFile constructor(room-bot, ...)
00:14:40 VERB StorageBackend constructor(room-bot, { type: file })
00:14:40 VERB MemoryCard load() from storage: StorageFile</sandbox/room-bot.memory-card.json>
00:14:40 VERB StorageFile load() from /sandbox/room-bot.memory-card.json
00:14:40 VERB MemoryCard load() file not exist, NOOP
00:14:40 VERB Wechaty initPuppet() wechaty-puppet-wechat4u
00:14:40 VERB MemoryCard multiplex(puppet)
00:14:40 VERB MemoryCard static multiplex(MemoryCard<room-bot>, puppet)
00:14:40 VERB MemoryCard constructor({"name":"room-bot","multiplex":{"name":"puppet","parent":{"options":{"name":"room-bot"},"name":"room-bot","payload":{},"multiplexNameList":[],"storage":{"name":"room-bot","options":{"type":"file"},"absFileName":"/sandbox/room-bot.memory-card.json"}}}})
00:14:40 VERB PuppetManager resolve({puppet: wechaty-puppet-wechat4u, puppetOptions: undefined})
00:14:40 VERB PuppetManager resolveName(wechaty-puppet-wechat4u)
00:14:40 VERB PuppetManager checkModule(wechaty-puppet-wechat4u)
00:14:40 VERB Puppet constructor({}) #0
00:14:40 VERB StateSwitch constructor(PuppetWechat4u, "{"log":{"enableTimestamp":true,"logLevel":4,"prefixFilter":{}}}")
00:14:40 VERB MemoryCard constructor(undefined)
00:14:40 VERB MemoryCard getStorage() for storage type: N/A
00:14:40 VERB MemoryCard load() from storage: N/A
00:14:40 VERB MemoryCard load() no storage
00:14:40 VERB Puppet constructor() watchdog timeout set to 60 seconds
00:14:40 VERB HotImport callerResolve(., /sandbox/node_modules/wechaty-puppet/dist/src/puppet.js)
00:14:40 VERB Puppet constructor() childClassPath=/sandbox/node_modules/wechaty-puppet-wechat4u/dist/src
00:14:40 VERB Puppet setMemory()
00:14:40 VERB Wechaty initPuppetEventBridge(Puppet#0<PuppetWechat4u>(room-bot))
00:14:40 VERB Wechaty initPuppetEventBridge() puppet.on(friendship) (listenerCount:0) registering...
00:14:40 VERB Wechaty initPuppetEventBridge() puppet.on(login) (listenerCount:0) registering...
00:14:40 VERB Wechaty initPuppetEventBridge() puppet.on(logout) (listenerCount:0) registering...
00:14:40 VERB Wechaty initPuppetEventBridge() puppet.on(message) (listenerCount:0) registering...
00:14:40 VERB Wechaty initPuppetEventBridge() puppet.on(room-invite) (listenerCount:0) registering...
00:14:40 VERB Wechaty initPuppetEventBridge() puppet.on(room-join) (listenerCount:0) registering...
00:14:40 VERB Wechaty initPuppetEventBridge() puppet.on(room-leave) (listenerCount:0) registering...
00:14:40 VERB Wechaty initPuppetEventBridge() puppet.on(room-topic) (listenerCount:0) registering...
00:14:40 VERB Wechaty initPuppetEventBridge() puppet.on(scan) (listenerCount:0) registering...
00:14:40 VERB Wechaty initPuppetEventBridge() puppet.on(dirty) (listenerCount:0) registering...
00:14:40 VERB Wechaty initPuppetEventBridge() puppet.on(dong) (listenerCount:0) registering...
00:14:40 VERB Wechaty initPuppetEventBridge() puppet.on(error) (listenerCount:0) registering...
00:14:40 VERB Wechaty initPuppetEventBridge() puppet.on(heartbeat) (listenerCount:0) registering...
00:14:40 VERB Wechaty initPuppetEventBridge() puppet.on(ready) (listenerCount:0) registering...
00:14:40 VERB Wechaty initPuppetEventBridge() puppet.on(reset) (listenerCount:0) registering...
00:14:40 VERB Wechaty wechatifyUserModules(Puppet#0<PuppetWechat4u>(room-bot))
00:14:40 VERB PuppetWechat4u start() with room-bot
00:14:40 VERB StateSwitch <PuppetWechat4u> on(pending) <- (false)
00:14:40 VERB MemoryCard <puppet> get(PUPPET-WECHAT4U)
00:14:40 VERB PuppetWechat4u monkeyPatchOffState(wechat4u, checkLogin)
00:14:40 VERB PuppetWechat4u monkeyPatchOffState(wechat4u, login)
00:14:40 VERB PuppetWechat4u monkeyPatchOffState(wechat4u, _init)
00:14:40 VERB PuppetWechat4u monkeyPatchHook(wechat4u, syncCheck, func)
00:14:40 VERB PuppetWechat4u initHookEvents()
00:14:40 VERB StateSwitch <PuppetWechat4u> on(true) <- (pending)
00:14:40 VERB Wechaty on(heartbeat, listener) registering... listenerCount: 0
00:14:40 VERB StateSwitch <Wechaty> on(true) <- (pending)
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█ ▄▄▄▄▄ █▄▀ ▀ ▀█▄ ▀█▄▄█ ▄▄▄▄▄ █
█ █   █ █   █▀  ▄▄▀ ▄▀█ █   █ █
█ █▄▄▄█ █▄█▀ ▄▄██▄▀▀ ██ █▄▄▄█ █
█▄▄▄▄▄▄▄█▄█ █ █ █ ▀▄▀▄█▄▄▄▄▄▄▄█
█  ▄▄██▄█▄█ ▄ ▀▄  ▄ ▀█ ▀▀ ▄▄█ █
███▀██▀▄▄   ▄▄  █▄█▀█ ▄▄█▀█▄▄▀█
██▄▄ ▄▄▄▀█▄▄▀ █▄▄ ▄█ █▄▀██▄ ▀▀█
█▄████ ▄ ██▀ █▄▀██▄▄▄▄ ▀  █▄ ▄█
████ ▀ ▄▀▀█ █▄▄ ▄█▀▄▄  █ ▄ ▀ ██
█▄███ ▀▄ █ ▀▀██▄▄▄▀▀█▀▀▀▄▀█ ███
██▄█▄▄█▄█ ▀███▀▀ ▀ ▀▀ ▄▄▄   ▀▀█
█ ▄▄▄▄▄ ██▀█▀▀▀▀█ █ ▄ █▄█  █▄██
█ █   █ █▀▄█ █▀▀▄▀▄█▀  ▄  ▀▄▄ █
█ █▄▄▄█ █ █▄█ ▀▄█▀█ ▄ ██▄▀▀▄▀▄█
█▄▄▄▄▄▄▄█▄▄▄▄███▄███▄▄▄██▄██▄██

https://login.weixin.qq.com/l/AYKUMKGzkQ==
[2] Scan QR Code in above url to login:
00:14:42 VERB PuppetWechat4u monkeyPatchOffState(checkLogin) funcNew()
00:15:09 VERB PuppetWechat4u monkeyPatchOffState(checkLogin) funcNew()
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█ ▄▄▄▄▄ █▄▀ ▀ ▀█▄ ▀█▄▄█ ▄▄▄▄▄ █
█ █   █ █   █▀  ▄▄▀ ▄▀█ █   █ █
█ █▄▄▄█ █▄█▀ ▄▄██▄▀▀ ██ █▄▄▄█ █
█▄▄▄▄▄▄▄█▄█ █ █ █ ▀▄▀▄█▄▄▄▄▄▄▄█
█  ▄▄██▄█▄█ ▄ ▀▄  ▄ ▀█ ▀▀ ▄▄█ █
███▀██▀▄▄   ▄▄  █▄█▀█ ▄▄█▀█▄▄▀█
██▄▄ ▄▄▄▀█▄▄▀ █▄▄ ▄█ █▄▀██▄ ▀▀█
█▄████ ▄ ██▀ █▄▀██▄▄▄▄ ▀  █▄ ▄█
████ ▀ ▄▀▀█ █▄▄ ▄█▀▄▄  █ ▄ ▀ ██
█▄███ ▀▄ █ ▀▀██▄▄▄▀▀█▀▀▀▄▀█ ███
██▄█▄▄█▄█ ▀███▀▀ ▀ ▀▀ ▄▄▄   ▀▀█
█ ▄▄▄▄▄ ██▀█▀▀▀▀█ █ ▄ █▄█  █▄██
█ █   █ █▀▄█ █▀▀▄▀▄█▀  ▄  ▀▄▄ █
█ █▄▄▄█ █ █▄█ ▀▄█▀█ ▄ ██▄▀▀▄▀▄█
█▄▄▄▄▄▄▄█▄▄▄▄███▄███▄▄▄██▄██▄██

https://login.weixin.qq.com/l/AYKUMKGzkQ==
[3] Scan QR Code in above url to login:
00:15:21 VERB PuppetWechat4u monkeyPatchOffState(checkLogin) funcNew()
00:15:25 VERB PuppetWechat4u monkeyPatchOffState(login) funcNew()
00:15:30 VERB PuppetWechat4u monkeyPatchOffState(_init) funcNew()
00:15:31 INFO Bot error: Error: 1 == 0
00:15:31 VERB MemoryCard <puppet> delete(PUPPET-WECHAT4U)
00:15:31 VERB MemoryCard <room-bot> save() to StorageFile</sandbox/room-bot.memory-card.json>
00:15:31 VERB StorageFile save() to /sandbox/room-bot.memory-card.json

We need full log instead of log screenshot or log fragments!

Show Logs ```shell $ WECHATY_LOG=silly node yourbot.js -> Make sure to copy/paste the full (instead of only fragments) log message in text format (instead of image/screenshot) at here ```

7. Additional context

Add any other context about the problem here.

huan commented 2 years ago

According to the below message when you are trying to login the web WeChat, we can confirm that your WeChat account is not be supported to use the Web Protocol:

"提示 For the security of your account, you cannot log in to WeChat for Web via this WeChat ID. You can go to the website https://weixin.qq.com/ to download the WeChat app and log in."

You can try using other puppet providers like XP, see the official docs at

jwwang2003 commented 2 years ago

Thx, Ill go check out the XP puppet provider! I used to be able to log in to web WeChat (around 2018), now it doesn't work. Could my location have something to do with this? Is it common for others to face this problem?

huan commented 2 years ago

I used to be able to log in to web WeChat (around 2018), now it doesn't work. Could my location have something to do with this? Is it common for others to face this problem?

I think only Tencent can answer the above question.

Good luck with trying using the XP, please let me know your result.

jwwang2003 commented 2 years ago

I think only Tencent can answer the above question.

Yeah, it seems like a mystery how it works in the backend. If only they can open up some official API specifically for building bots (like Discord) that would be awesome T_T.

leochen-g commented 1 year ago

This problem has been fixed in the next version, please use the next version. Like npm i wechaty-puppet-wechat4u@next --save