Javascript CORS policy error


I am in MT Cloud enviroment.

Now I am trying to get Access Token for ION API via Javascript:

But I am receiving this error:

What am I doing wrong? Or this can't be done via UserControl Javascript?

  • I would do the ion api call in the framework and pass in the response to the UserControl. Doing it in the UserControl exposes your info in the client. Anyone can bring up the source tab and view your UserControl

  • Hi Pavel - this is a CORS error generated by your local browser. 

    To test above site you could run your browser without CORS check. This is only for dev work not for prod,

    Below shortcut would start Chrome without CORS check. 
    "C:\Program Files\Google\Chrome\Application\chrome.exe" --user-data-dir="C://chrome-dev-disabled-security" --disable-web-security --disable-site-isolation-trials

    If you set up your Authorize App in ION API management of type as Web Application you can provide an Authorized JavaScript Origins (url of your webserver). This will not solve sign on - but once you have a bearer token you will have no CORS issue.

    As Yao indicates it is best to get the token in the back-end.

  • Ok, thank for info, I will try to mange that.

    As you mentioned calling API directly from Mongoose FormScript. I would love do that, but there is an error in POST ION API for SunSystems, and it is not working from Mongoose FormScript directly. I am solving this issue with Infor Helpdesk for more then half a year, but without any luck.

    That's why I'm looking for other ways, even though I know they're not entirely ideal. But this API is critical for our application