mamoe / mirai

高效率 QQ 机器人支持库
https://mirai.mamoe.net
GNU Affero General Public License v3.0
14.37k stars 2.53k forks source link

支持短信验证码登录 #717

Open Him188 opened 3 years ago

Him188 commented 3 years ago
Exception in thread "main" net.mamoe.mirai.network.WrongPasswordException: Error(title=禁止登录, message=为了您的帐号安全,请使用QQ一键登录(通过手机QQ授权登录)。, errorInfo=)
BadDeveloper2022 commented 3 years ago

最新版也出现:Recv: Error(title=禁止登录, message=为了您的帐号安全,请使用QQ一键登录(通过手机QQ授权登录)。, errorInfo=)

BadDeveloper2022 commented 3 years ago

@Him188 这个能不手机上显示验证? 也许第一次验证后后面不会出现吧

Him188 commented 3 years ago

这个issue就是要支持这种验证方式,有待研究

ghost commented 3 years ago

这个issue就是要支持这种验证方式,有待研究

他的修复了 fix protocol

anaivebird commented 3 years ago

@Him188 参照MiraiGo修复一下吧,现在大家用2.0-M1都没法登陆https://github.com/Mrs4s/MiraiGo/commit/3a65d05f33782f6e6d3d00234f44ffd7660bea64

image

zeylei commented 3 years ago

确实,我也没法登录,所有的都不行,完全不能用。

anaivebird commented 3 years ago

确实,我也没法登录,所有的都不行,完全不能用。

已经修了,commit在这里,只不过要下个版本才有jar包吧

Him188 commented 3 years ago

确实,我也没法登录,所有的都不行,完全不能用。

已经修了,https://github.com/mamoe/mirai/commit/3252221308d5544a9b64eb23cb3d8fc4aefd03a3,只不过要下个版本才有jar包吧

看tag,已经在 2.0-M1-1 包含

zeylei commented 3 years ago

还是不行,现在虽然支持滑块验证了,但是验证完之后还是会失败: Error(title=禁止登录, message=当前上网环境异常,请更换网络环境或在常用设备上登录或稍后再试。, errorInfo=)

zeylei commented 3 years ago

简单来说,如果是:1、新用户,第一次验证需要生成新的device.json。2、老用户不小心丢失了device.json,需要重新认证。都是完全无法使用mirai的。而一个老用户如果已经有device.json了,那么他就没有这样的问题。目前可能大多数的测试和开发都是基于一个老用户的使用场景的,因此可能就无法发现这个问题。建议在测试的时候,可以更多的对“新用户使用”的场景进行测试。

sandtechnology commented 3 years ago

简单来说,如果是:1、新用户,第一次验证需要生成新的device.json。2、老用户不小心丢失了device.json,需要重新认证。都是完全无法使用mirai的。而一个老用户如果已经有device.json了,那么他就没有这样的问题。目前可能大多数的测试和开发都是基于一个老用户的使用场景的,因此可能就无法发现这个问题。建议在测试的时候,可以更多的对“新用户使用”的场景进行测试。

1.主要问题是大多数用户不会考虑网络环境(即登录地不在常用登录地)的情况,从而遭遇网络环境异常错误,而应对这种情况的唯一办法就是挂电脑QQ几天后再尝试。 2.device.json对应了你的设备信息,从QQ风控的逻辑来看,当设备变化而在常用登录地下会允许登录,反之亦然,并不存在”老用户不小心丢失了device.json,需要重新认证。都是完全无法使用mirai的“的问题。 3.如果两者(常用设备、常用登录地)都无,那请参考1的解决方案。 4.由于使用环境千奇百怪,新用户遇见的验证是不可知的,只能通过提交issue的方式让开发者得知,请谅解。

BlackcatWatcher commented 3 years ago

问题:2.0-M1出现同样提示,在用2.0-M1-1后,没有了“使用QQ一键登录”的提示,但出现网络错误。 关键点:1.服务器在异地,但挂了两周的PC QQ。2.几天前曾被风控(1.3.3版),PC和手机都能登上号,就mirai被封登录,但登录其他号可以上,提示版本过旧。(换过device信息也一样)。 以下是控制台输出:

2020-12-21 00:41:49 I/Bot.xxxxxxxxx: Logging in...
2020-12-21 00:42:05 W/Bot.xxxxxxxxx: kotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 5000 ms
kotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 5000 ms
        at kotlinx.coroutines.TimeoutKt.TimeoutCancellationException(Timeout.kt:186)
        at kotlinx.coroutines.TimeoutCoroutine.run(Timeout.kt:156)
        at kotlinx.coroutines.EventLoopImplBase$DelayedRunnableTask.run(EventLoop.common.kt:497)
        at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)
        at kotlinx.coroutines.DefaultExecutor.run(DefaultExecutor.kt:69)
        at java.base/java.lang.Thread.run(Thread.java:832)

2020-12-21 00:42:05 I/Bot.xxxxxxxxx: Connection lost, retrying login
2020-12-21 00:42:20 W/Bot.xxxxxxxxx: kotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 5000 ms
kotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 5000 ms
        at kotlinx.coroutines.TimeoutKt.TimeoutCancellationException(Timeout.kt:186)
        at kotlinx.coroutines.TimeoutCoroutine.run(Timeout.kt:156)
        at kotlinx.coroutines.EventLoopImplBase$DelayedRunnableTask.run(EventLoop.common.kt:497)
        at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)
        at kotlinx.coroutines.DefaultExecutor.run(DefaultExecutor.kt:69)
        at java.base/java.lang.Thread.run(Thread.java:832)

2020-12-21 00:42:20 W/Bot.xxxxxxxxx: kotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 5000 ms
kotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 5000 ms
        at kotlinx.coroutines.TimeoutKt.TimeoutCancellationException(Timeout.kt:186)
        at kotlinx.coroutines.TimeoutCoroutine.run(Timeout.kt:156)
        at kotlinx.coroutines.EventLoopImplBase$DelayedRunnableTask.run(EventLoop.common.kt:497)
        at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)
        at kotlinx.coroutines.DefaultExecutor.run(DefaultExecutor.kt:69)
        at java.base/java.lang.Thread.run(Thread.java:832)

2020-12-21 00:42:20 W/Bot.xxxxxxxxx: java.lang.IllegalStateException: network channel is closed
java.lang.IllegalStateException: network channel is closed
        at net.mamoe.mirai.internal.network.QQAndroidBotNetworkHandler.sendAndExpect(QQAndroidBotNetworkHandler.kt:632)
        at net.mamoe.mirai.internal.network.QQAndroidBotNetworkHandler.sendAndExpect$default(QQAndroidBotNetworkHandler.kt:626)
        at net.mamoe.mirai.internal.network.QQAndroidBotNetworkHandler.closeEverythingAndRelogin(QQAndroidBotNetworkHandler.kt:155)
        at net.mamoe.mirai.internal.network.QQAndroidBotNetworkHandler$closeEverythingAndRelogin$1.invokeSuspend(QQAndroidBotNetworkHandler.kt)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

2020-12-21 00:42:20 W/Bot.xxxxxxxxx: java.lang.IllegalStateException: network channel is closed
java.lang.IllegalStateException: network channel is closed
        at net.mamoe.mirai.internal.network.QQAndroidBotNetworkHandler.sendAndExpect(QQAndroidBotNetworkHandler.kt:632)
        at net.mamoe.mirai.internal.network.QQAndroidBotNetworkHandler.sendAndExpect$default(QQAndroidBotNetworkHandler.kt:626)
        at net.mamoe.mirai.internal.network.QQAndroidBotNetworkHandler.closeEverythingAndRelogin(QQAndroidBotNetworkHandler.kt:155)
        at net.mamoe.mirai.internal.network.QQAndroidBotNetworkHandler$closeEverythingAndRelogin$1.invokeSuspend(QQAndroidBotNetworkHandler.kt)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
Him188 commented 3 years ago

短信验证应该也需要处理滑动验证码, 现阶段要支持免密登录 #119 更划算

AdoptOSS commented 3 years ago

似乎可以参考 takayama-lily/oicq@7b56771c87c0f663885e482f2ee7109f963f24e8

Him188 commented 2 years ago

2216 支持用短信验证码解决设备锁, 这个 issue 用于记录不使用密码而直接使用短信登录