【问题标题】:How to send requests to Xbox Live Restful API?如何向 Xbox Live Restful API 发送请求?
【发布时间】:2019-01-22 00:29:37
【问题描述】:

我想向 Xbox Live Restful API 的个人资料 URI 和人员 URI 发送请求。这两个接口的Authorization部分看不懂。

我使用follow命令向POST (/users/batch/profile/settings)发送请求:

curl -X POST \
  https://profile.xboxlive.com/users/batch/profile/settings \
  -H 'Signature: xxxx' \
  -H 'Authorization: XBL3.0 x=xxxx' \
  -H 'Content-Type: application/json' \
  -H 'x-xbl-contract-version: 2' \
  -d '{
    "userIds": [
        "xxxx"
    ],
    "settings": [
        "AppDisplayName",
        "GameDisplayName",
        "Gametag",
        "AppDisplayPicRaw",
        "GameDisplayPicRaw",
        "AccountTier",
        "TenureLevel",
        "Gamescore"
    ]   
}'

Xbox Live Restful API 返回 403。

我使用follow命令向GET (/users/{ownerId}/people)发送请求:

curl -X GET \
  'https://social.xboxlive.com/users/xuid(xxxx)/people' \
  -H 'Signature: xxxx' \
  -H 'Authorization: XBL3.0 x=xxxx'

它也返回 403。

是否有一些演示来展示如何调用 Xbox Live Restful API?

some search之后,我们应该在请求的头部传递SignatureAuthorization。我们可以从GetTokenAndSignatureAsync中得到SignatureAuthorization以及Authorization中编码的声明和XUID,但它仍然返回403。

【问题讨论】:

  • 你有没有想过这个问题?
  • @JeffThomas 我已经写下了我的答案。

标签: xbox xbox-live


【解决方案1】:

我已按照xbox-webapi-pythonauthenticate 获取Authorization 标头(XBL3.0 x=<uhs>,<xsts>)。只需将Authorization 添加到每个 Xbox Live API 请求旁边的其他必需标头,您就可以获得正确的响应。

Authorization 的值也可以通过getTokenAndSignatureAsync 得到。此值适用于所有 Xbox API 端点。

【讨论】:

  • 我在我的代码中做同样的事情,在这种情况下仍然得到 403。当我传递从 Windows 10(xbox 覆盖)捕获的“授权”标头时,尽管请求成功
猜你喜欢
  • 2015-01-26
  • 2013-10-24
  • 2023-03-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-07-05
  • 1970-01-01
  • 2018-04-23
相关资源
最近更新 更多