【问题标题】:xboxlive authentication error 400 bad requestXbox Live 身份验证错误 400 错误请求
【发布时间】:2021-03-26 11:47:24
【问题描述】:

我正在尝试使用 msal 节点(我正在使用这个 sample)在 xbox live 中与 Microsoft 进行身份验证并使用我返回的令牌,问题是当我收到错误 400(错误请求)时尝试调用 xboxlive。

 await axios
        .post(
            "https://user.auth.xboxlive.com/user/authenticate",
            {
                Properties: {
                    AuthMethod: "RPS",
                    SiteName: "user.auth.xboxlive.com",
                    RpsTicket: token, // the token i get from msal
                },
                RelyingParty: "http://auth.xboxlive.com",
                TokenType: "JWT",
            },
            {
                headers: {
                    "Content-Type": "application/json",
                    Accept: "application/json",
                },
            }
        )
        .then((x) => console.log("success", x))
        .catch((e) => console.error("error", e));

【问题讨论】:

    标签: node.js msal msal.js xbox-live


    【解决方案1】:

    看来您需要在令牌前面加上d=,然后将其作为 RpsTicket 的值传递。这是基于xbox-webapi-node npm module。

    await axios.post(
       "https://user.auth.xboxlive.com/user/authenticate",
       {
           Properties: {
               AuthMethod: "RPS",
               SiteName: "user.auth.xboxlive.com",
               RpsTicket: "d=" + token, // the token
           },
           RelyingParty: "http://auth.xboxlive.com",
           TokenType: "JWT",
        },
        {
            headers: {
                "Content-Type": "application/json",
                Accept: "application/json",
            },
         }
    )
    .then((x) => console.log("success", x))
    .catch((e) => console.error("error", e));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-07-06
      • 2016-11-14
      • 1970-01-01
      • 1970-01-01
      • 2017-06-01
      • 2023-02-26
      • 2018-01-19
      相关资源
      最近更新 更多