【发布时间】:2016-10-20 20:48:08
【问题描述】:
我正在尝试设置 Autodesk 查看应用程序的快速 POC,但我遇到了身份验证问题。我已经检查了以下问题以寻求一般帮助,但它们要么涉及非常具体的问题,例如 HashTableMapping,要么甚至没有得到回答:
HTTP Status 415 - Unsupported Media Type when doing POST
HTTP status 415 when using Alamofire multipart upload
HTTP Error 500 when attempting to access localhost
The request failed with HTTP status 415
根据 Autodesk 的documentation,我的请求结构完全正常,但似乎引发了 415 错误。任何人有任何想法或看到我没有看到的东西?下面是我的代码:
var XmlHttpRequest = require("xmlhttprequest").XMLHttpRequest;
console.log("references loaded");
var xhr = new XmlHttpRequest();
xhr.open("POST", "https://developer.api.autodesk.com/authentication/v1/authenticate", false);
var headerRequest = "Content-Type: application/x-www-form-urlencoded";
var headerValue =
"client_id=_someSecretValue_" + "&" +
"client_secret=_someOtherSecretValue_" + "&" +
"grant_type=client_credentials" + "&" +
"scope=data:read";
xhr.setRequestHeader(headerRequest, headerValue);
xhr.send();
console.log(xhr.status); //getting a 415 here
console.log(xhr.statusText);
【问题讨论】:
标签: xmlhttprequest autodesk-viewer autodesk-forge autodesk-model-derivative