Microsoft Store collection REST API,创建 Azure AD 访问令牌 returns 404

Microsoft Store collection REST API, Create Azure AD access tokens returns 404

我正在学习教程 "Manage product entitlements from a service" here,

我卡在了第 3 步,其中请求访问令牌的调用 return 出现 404 错误。

第 1 步: 在 Azure 门户中,

步骤 2: 在 MS DevCenter

已将 _APP_ID_ 添加到 "Services-> Product collections and purchases -> Client ID"。

第 3 步: 使用 Postman 进行测试

我从 PortalDiagnostics.json 中提取了 Azure AD 租户 ID _TENANT_ID_。 使用提供的示例,我使用 postman 到 post 如下:

POST https://login.microsoftonline.com/_TENANT_ID_/oauth2/token HTTP/1.1
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded; charset=utf-8

grant_type=client_credentials
&client_id=_APP_ID_
&client_secret=_APP_SECRET_
&resource=https://onestore.microsoft.com

主机和内容类型在 headers 中设置,其余部分 post 在 body 中作为原始文本编辑。

邮递员 headers & body POSTMAN headers POSTMAN body

如您所见,结果是没有 body 的 404,这使得排除故障有点困难。

问题:

  1. 我是否在第 1 步和第 2 步中遗漏了一些明显的东西?
  2. 我可以用 POSTMAN 测试吗?

如有任何指点,我将不胜感激;我找不到任何其他教程来交叉参考。

所以在这种情况下,问题是 URL 末尾的流氓 HTTP/1.1 + 表单数据中的一些未编码内容。使用 Postman 的 x-www-form-urlencoded 选项卡对此有所帮助,因为它会为您编码所有字段。