Search code examples
c#jqueryxmlhttprequestautodesk-forge

Autodesk Forge Error trying to access the API online


I have a problem loading a 3D model on an online server, the error shown is related to accessing the Forge API, locally works smoothly however when mounted on the server or a website is made marks the following error "Failed to load resource: the server responded with a status of 404 (Not Found)", then "onDocumentLoadFailure() - errorCode:7". As I comment, what I find stranger is that, locally, it works. Attached the segment of the code where it displays the error.

 function getAccessToken() {
    var xmlHttp = null;
    xmlHttp = new XMLHttpRequest();
    xmlHttp.open("GET", '/api/forge/toke', false); //Address not found
    xmlHttp.send(null);
    return xmlHttp.responseText;
}

Thank you very much in advance.


Solution

  • I've already found the issue. When I make the deploy I have to change the url where the request is made for the public or the name of the domain. For example: mywebsite.com/aplication-name/api/forge/token.