You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Had the same issue. Found when using postman app and doing authentication by hand that the Innovator Server (2024) does not like the Content-Type to be multipart/form-data. Seems to only work when it's "application/x-www-form-urlencoded". The getOAuthToken(creds) function sets up the var token_body as a FormData object ... when the http request eventually gets made, that FormData object will cause the Content-Type to be multipart/form-data. Which will faill with Error 400. Fix is to manually set the header and use a string for token_body.
In the getOAuthToken(creds) ... REMOVE:
// build the OAuth token request
var token_headers = [];
var token_body = new FormData();
token_body.set("grant_type", "password");
token_body.set("scope", "Innovator");
token_body.set("client_id", "IOMApp");
token_body.set("username", creds.user);
token_body.set("password", creds.pwd);
token_body.set("database", creds.db);
and REPLACE it with:
// build the OAuth token request
var token_headers = [
{ name: 'Content-Type', value: 'application/x-www-form-urlencoded' }
];
// Example URL-encoded token body
var token_body =
"grant_type=password" +
"&scope=Innovator" +
"&client_id=IOMApp" +
"&username=" + encodeURIComponent(creds.user) +
"&password=" + encodeURIComponent(creds.pwd) +
"&database=" + encodeURIComponent(creds.db);
Expected Behavior
getOAuthToken should return a valid OAuth token.
Actual Behavior
It throws the following error message:
Warning! Error in getOAuthToken: 400 (Bad Request) from http://localhost/xxxxx/OAuthServer/connect/token
Steps to Reproduce
Environment Details
Aras Innovator
Browsers
Project Version
v2.0.0
Additional Details
Workaround / Solution
Have you found a workaround or solution to this issue?
No.
Collaboration
Are you willing to collaborate on this feature? Ex: sharing code, submitting a pull request, testing, etc.
Yes.
The text was updated successfully, but these errors were encountered: