Skip to content

Conversation

@allMagicNB
Copy link

No description provided.

@pcl-ce-automation pcl-ce-automation bot added 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 size: M PR 大小评估:中型 labels Sep 1, 2025
Dim Random As New Random
Dim RedirectUri As String = $"http://localhost:{Random.Next(1024, 65535)}/"
Dim State As String = Random.Next(10000, 99999)
Dim HttpListener As New HttpListener

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ruattd 你改下这还是指导改下?

Dim Result As String() = {"Ignore", ""}
If (Code <> Nothing AndAlso Context.Request.QueryString("state") = State) Then
Context.Response.StatusCode = 200
ResponseString = "<html><head><meta charset=""UTF-8""></head><body><h1>成功!</h1><h2>你现在可以关闭此页面。</h2></body></html>"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用 oauth-complete.html 什么的吧……这个设计有点小简陋了……

Comment on lines -612 to -631
Dim PrepareJson As JObject = GetJson(NetRequestRetry("https://login.microsoftonline.com/consumers/oauth2/v2.0/devicecode", "POST",
$"client_id={OAuthClientId}&tenant=/consumers&scope=XboxLive.signin%20offline_access", "application/x-www-form-urlencoded"))
McLaunchLog("网页登录地址:" & PrepareJson("verification_uri").ToString)

'弹窗
Dim Converter As New MyMsgBoxConverter With {.Content = PrepareJson, .ForceWait = True, .Type = MyMsgBoxType.Login}
WaitingMyMsgBox.Add(Converter)
While Converter.Result Is Nothing
Thread.Sleep(100)
End While
If TypeOf Converter.Result Is RestartException Then
If MyMsgBox($"请在登录时选择 {vbLQ}其他登录方法{vbRQ},然后选择 {vbLQ}使用我的密码{vbRQ}。{vbCrLf}如果没有该选项,请选择 {vbLQ}设置密码{vbRQ},设置完毕后再登录。",
"需要使用密码登录", "重新登录", "设置密码", "取消",
Button2Action:=Sub() OpenWebsite("https://account.live.com/password/Change")) = 1 Then
GoTo Retry
Else
Throw New Exception("$$")
End If
ElseIf TypeOf Converter.Result Is Exception Then
Throw CType(Converter.Result, Exception)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应当保留原实现,这对于特定应用场景(例如通过其他设备完成登录)有帮助

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应当保留原实现,这对于特定应用场景(例如通过其他设备完成登录)有帮助

不如二维码(

Copy link
Member

@copytiao copytiao Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应当保留原实现,这对于特定应用场景(例如通过其他设备完成登录)有帮助

不如二维码(

应当保留原实现,这对于特定应用场景(例如通过其他设备完成登录)有帮助

不如二维码(

但是你没监听 0.0.0.0 (

@copytiao
Copy link
Member

copytiao commented Sep 1, 2025

仅建议,非必须

对于公共客户端,可以考虑实现 PKCE 以提高安全性

@copytiao copytiao added ✏️ 修正 and removed 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 labels Sep 1, 2025
@pcl-ce-automation pcl-ce-automation bot added 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 and removed ✏️ 修正 labels Sep 1, 2025
@tangge233
Copy link

倒是可以作为可选登录方式,毕竟 HttpListener 在部分情况下会抽风 :\

@allMagicNB
Copy link
Author

allMagicNB commented Sep 1, 2025

倒是可以作为可选登录方式,毕竟 HttpListener 在部分情况下会抽风 :\

有没真实案例?

allMagicNB and others added 2 commits September 1, 2025 23:12
Co-authored-by: 薄奚梦灵 <[email protected]>
@allMagicNB
Copy link
Author

allMagicNB commented Sep 1, 2025

WIP 吧先,线程还没改。

@allMagicNB allMagicNB marked this pull request as draft September 1, 2025 15:28
@pcl-ce-automation pcl-ce-automation bot added 🚧 正在处理 开发人员正在对该内容进行开发、测试或修复,进展中 and removed 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 labels Sep 1, 2025
@ruattd
Copy link
Contributor

ruattd commented Sep 3, 2025

有没真实案例?

#1319

Copy link
Contributor

@ruattd ruattd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不应该去掉设备代码流的支持,而应该在设置中添加一个可选项

另外,建议看看 naid 登录怎么实现的,有现成的流程,代码基本完全可复用,都不用你自己开 HttpListener

@allMagicNB
Copy link
Author

不应该去掉设备代码流的支持,而应该在设置中添加一个可选项

另外,建议看看 naid 登录怎么实现的,有现成的流程,代码基本完全可复用,都不用你自己开 HttpListener

车好的轮子没看着自己又车了一遍.jpg

@allMagicNB
Copy link
Author

另外,建议看看 naid 登录怎么实现的,有现成的流程,代码基本完全可复用,都不用你自己开 HttpListener

emm,没看错的话没实现 state 参数校验。(

@ruattd
Copy link
Contributor

ruattd commented Sep 5, 2025

emm,没看错的话没实现 state 参数校验。(

这是什么

@allMagicNB
Copy link
Author

emm,没看错的话没实现 state 参数校验。(

这是什么

https://tools.ietf.org/html/rfc6749#section-10.12

@ruattd
Copy link
Contributor

ruattd commented Sep 5, 2025

https://tools.ietf.org/html/rfc6749#section-10.12

那你实现一下吧,naid 不支持这个东西所以就没做

@Chiloven945 Chiloven945 changed the title feat. AuthCode Flow feat: AuthCode Flow Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: M PR 大小评估:中型 🚧 正在处理 开发人员正在对该内容进行开发、测试或修复,进展中

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants