-
Couldn't load subscription status.
- Fork 4
feat: AuthCode Flow #1513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
feat: AuthCode Flow #1513
Conversation
| 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 |
There was a problem hiding this comment.
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>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用 oauth-complete.html 什么的吧……这个设计有点小简陋了……
| 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应当保留原实现,这对于特定应用场景(例如通过其他设备完成登录)有帮助
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应当保留原实现,这对于特定应用场景(例如通过其他设备完成登录)有帮助
不如二维码(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应当保留原实现,这对于特定应用场景(例如通过其他设备完成登录)有帮助
不如二维码(
应当保留原实现,这对于特定应用场景(例如通过其他设备完成登录)有帮助
不如二维码(
但是你没监听 0.0.0.0 (
|
仅建议,非必须 对于公共客户端,可以考虑实现 PKCE 以提高安全性 |
|
倒是可以作为可选登录方式,毕竟 HttpListener 在部分情况下会抽风 :\ |
有没真实案例? |
Co-authored-by: 薄奚梦灵 <[email protected]>
|
WIP 吧先,线程还没改。 |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不应该去掉设备代码流的支持,而应该在设置中添加一个可选项
另外,建议看看 naid 登录怎么实现的,有现成的流程,代码基本完全可复用,都不用你自己开 HttpListener
车好的轮子没看着自己又车了一遍.jpg |
emm,没看错的话没实现 state 参数校验。( |
这是什么 |
|
|
那你实现一下吧,naid 不支持这个东西所以就没做 |
No description provided.