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

access_key相关 #8

Closed
guozhigq opened this issue Aug 5, 2023 · 1 comment
Closed

access_key相关 #8

guozhigq opened this issue Aug 5, 2023 · 1 comment

Comments

@guozhigq
Copy link
Owner

guozhigq commented Aug 5, 2023

获取方式:模拟第三方登录

  1. Request.get https://passport.bilibili.com/login/app/third ,携带参数appKey、api、sign
    三者都为固定值
 const res = await request.get('https://passport.bilibili.com/login/app/third', {
      params: {
        appkey: 27eb53fc9058f8c3,
        api: 'https://www.mcbbs.net/template/mcbbs/image/special_photo_bg.png',
        sign: '04224646d1fea004e79606d3b038c84a',
      },
      withCredentials: true,
    }
 )
  1. 请求成功,返回如下内容
 {
    "code": 0,
    "status": true,
    "ts": 1691214639,
    "data": {
      "api_host": "www.mcbbs.net",
      "has_login": 1,
      "direct_login": 0,
      "user_info": {
        "mid": 123213123,
        "uname": "xxx",
        "face": "https://i0.hdslb.com/bfs/face/f52c01ddadedewf52f1959dae37ca09588fa35acc6ab.jpg"
       },
      "confirm_uri": "https://passport.bilibili.com/login/appSuccess?api=https%3A%2F%2Fwww.mcbbs.net%2Ftemplate%2Fmcbbs%2Fimage%2Fspecial_photo_bg.png&appkey=27eb53fc9058f8c3&sign=04224646d1fea004e79606d3b038c84a&mhash=8ce9da4e67d96f048a7bfcb5cb763625&confirm=1"
     }
}
  1. Request.get 上述返回内容中的confirm_uri字段,会302重定向到新地址,响应头Location字段中即包含access_key字段

同样的,请求https://passport.bilibili.com/login/app/third?appkey=27eb53fc9058f8c3&api=http://link.acg.tv/forum.php&sign=67ec798004373253d60114caaad89a8c 也可以间接获取access_key

注意,在后续请求中appkeyaccess_key需要是对应关系

@guozhigq
Copy link
Owner Author

guozhigq commented Aug 5, 2023

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