Skip to content
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

[新功能] LittleSkin OAuth 登录 #5021

Draft
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

wuliaodexiaoluo
Copy link
Contributor

@wuliaodexiaoluo wuliaodexiaoluo commented Oct 27, 2024

Close #4941 (关联投票 #4948

此 PR 对微软登录流程进行了破坏性改动

目前微软登录可能无法正常进行
此问题已修复

ToDo List

  • LittleSkin OAuth 网页登录
  • 兼容微软登录
  • 刷新 LittleSkin API AccessToken
  • 支持获取请求 ID (受阻碍)

登录逻辑

目前实现是如果 ClientID 不为空且 BaseUrl 包含 littleskin.cn 则优先进行 LittleSkin OAuth 登录

如果没有 ClientID 则填写账号密码可以进行原始登录

目前比较大的槽点

LittleSkin 登录取消授权不会自动关闭弹窗(正在尝试修复)
可能用户在启动器输入账号密码后再在网页输入一遍,体验有点不太好,或许可以考虑提示条?
LittleSkin OAuth 登录后可能会有个报错,因为 OAuth 登录不需要保存账号和密码,访问这段数据会抛出索引超界异常

注意事项

申请权限需要

User.Read offline_access openid Yggdrasil.PlayerProfiles.Select Yggdrasil.MinecraftToken.Create

这五个权限,其中有 1 个 是可选项但强烈建议申请即 openid,因为 AccessToken 也会编码选择档案的 UUID,可以通过公开 API 查询,但是这段逻辑还没测试过,openid 会编码角色名和 UUID,可以少一步,并且测试可用(没有明显报错)

需要在申请邮件内附上用于正式环境,否则默认申请的是测试环境,测试环境只能应用所有者登录

目前还有点没完成即 LittleSkin OAuth AccessToken 的刷新

写的不好,需要再改改 awa

本人学业繁忙,无法及时回复信息,一般情况下会在周一、周五、周末集中回复和问题(如果学校不调课不调休的话)
一些较大的问题可能会推迟到周末再解决,见谅

@wuliaodexiaoluo wuliaodexiaoluo marked this pull request as draft October 27, 2024 04:15
Copy link

@sulingjiang sulingjiang left a comment

Choose a reason for hiding this comment

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

配置好像变了?
小洛你再看看?

@JingHai-Lingyun JingHai-Lingyun added · 新功能 社区处理中 社区正在调查或处理该项 labels Oct 27, 2024
Copy link

@sulingjiang sulingjiang left a comment

Choose a reason for hiding this comment

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

相关 Bug 修复

Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb Outdated Show resolved Hide resolved
Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb Outdated Show resolved Hide resolved
Plain Craft Launcher 2/Pages/PageLaunch/MyMsgLogin.xaml.vb Outdated Show resolved Hide resolved
@wuliaodexiaoluo wuliaodexiaoluo marked this pull request as ready for review October 27, 2024 06:34
@wuliaodexiaoluo wuliaodexiaoluo marked this pull request as draft October 27, 2024 06:34
@wuliaodexiaoluo
Copy link
Contributor Author

wuliaodexiaoluo commented Oct 27, 2024

可能要等到下周去学校做了,下午要回学校上晚自习 awa

EDIT:如果问题太大可能得堆到下周末 awa

@wuliaodexiaoluo
Copy link
Contributor Author

怎么又是 Unverified 。。。

@wuliaodexiaoluo
Copy link
Contributor Author

Line in 421-428, in ModNet.vb

Try
                    If ex.Response Is Nothing Then Exit Try
                    DataStream = ex.Response.GetResponseStream()
                    DataStream.WriteTimeout = Timeout
                    DataStream.ReadTimeout = Timeout
                    Using Reader As New StreamReader(DataStream)
                        Res = Reader.ReadToEnd()
                    End Using

由于只返回了内容,无法获取请求头
这会直接影响到 支持获取请求 ID
鉴于这部分属于非常底层的实现,改动此部分可能导致大部分功能出现问题,需要加一个重复实现(

@wuliaodexiaoluo
Copy link
Contributor Author

If ex.Message.Contains("authorization_declined") Or ex.Message.Contains("access_denied") Then
                    Finished(New Exception("$你拒绝了 PCL 申请的权限……"))
                    Return

明明有检查啊,这又是什么问题?

@wuliaodexiaoluo
Copy link
Contributor Author

看了一眼,压根看不出来有什么问题,VSCode 也不支持检查,VB 的报错也不大懂。。。
考虑到再继续测下去可能会有被标记的风险,应该是只能等周末上 VisualStudio 看了
如果有人愿意的话也可以帮我看看

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
· 新功能 社区处理中 社区正在调查或处理该项
Projects
None yet
Development

Successfully merging this pull request may close these issues.

支持 LittleSkin 的 OAuth 登录获取 access_token
4 participants