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

[新增/更新请求] 网页登录时手机号验证出现的另一种形式 #1195

Closed
1 task done
Nemo2011 opened this issue Feb 4, 2025 · 0 comments
Closed
1 task done

Comments

@Nemo2011
Copy link
Contributor

Nemo2011 commented Feb 4, 2025

提交前请确认

  • 我已检索仓库中文档,不包含所提及内容,或所提及内容在本仓库中存在错误,且 Issues、Pull Requests 中无相关提交

API 来源

Web 端(含 h5)

API 类型

REST

API 地址

https://passport.bilibili.com/x/safecenter/sec/verify

详情描述

在进行密码登录过程中遇到手机号验证,登录接口理应返回一个链接,通往手机号验证页面。此验证页面链接的参数中期望包含 request_idtmp_token 字段,然而实际操作中却发现返回的链接缺失 request_id 字段。

request_id 在手机号验证全过程中只出现在验证手机验证码接口,即 https://passport.bilibili.com/x/safecenter/login/tel/verify。在这种特殊情况下,验证手机验证码接口变为 https://passport.bilibili.com/x/safecenter/sec/verify。两个接口传入的字段的差异为, type: loginTelCheck 变为了 verify_type: sms

此接口返回值与 https://passport.bilibili.com/x/safecenter/login/tel/verify 保持一致,之后的过程也几乎一致。只是最后的交换 cookies 接口 https://passport.bilibili.com/x/passport-login/web/exchange_cookie 无需再提供 request_id 字段,取而代之的是 go_url 字段,值为 https://passport.bilibili.com/pc/passport/risk/secTip?gourl=https%3A%2F%2Fwww.bilibili.com%2F&bind_tel=1

提供一个全过程复现,加粗接口为不符合预期表现的接口:

{
  "code": 0,
  "message": "0",
  "ttl": 1,
  "data": {
    ...
    // 此为文档中提供的预期
    "url": "https://passport.bilibili.com/h5-app/passport/risk/verify?tmp_token=imtmptk&request_id=imreqid&source=risk",
    // 实际
    "url": "https://passport.bilibili.com/h5-app/passport/risk/verify?scene=secLogin&tmp_token=imtmptk&gourl=https%253A%252F%252Fwww.bilibili.com%252F"
    ...
  }
}

form data: verify_type=sms&tmp_code=imtmptk&captcha_key=验证码key&code=验证码&csrf=***

form data: source=main_web&code=交换代码&go_url=https:%2F%2Fpassport.bilibili.com%2Fpc%2Fpassport%2Frisk%2FsecTip%3Fgourl%3Dhttps%253A%252F%252Fwww.bilibili.com%252F%26bind_tel%3D1&csrf=***

@Nemo2011 Nemo2011 closed this as completed Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant