cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Login Authorization Failed Error when executing ContentLoaderFunctions such as GetJSON or PostJSON

RGosline
9-Granite

Login Authorization Failed Error when executing ContentLoaderFunctions such as GetJSON or PostJSON

Hi,

 

I am running into authorization issues when trying to execute ContentLoaderFunctions such as GetJSON, or PostJSON. I have used debug logging and PostText statements to get more troubleshooting information. The Script Logs indicate the following error:


Login Authorization Failed

 

The server could not verify that you are authorized to access this document. The credentials you provided are either invalid (for example, you entered the wrong password) or your password has expired.

 

Alternately, your browser may be unable to provide the credentials that are required for authorization. Contact your organization’s administrator for more specific information about this error.

 

I can get everything to work for my account by adding my username and password to the parameters, but this is not a desirable solution in our production environment. Since the users are already authenticated via Windchill, is there a way to use that already established authentication for these types of services instead to hard coding username and password? Is this a permissions issue?


This very simple local Javascript service on an OData Connector with no input or output (other than logging) demonstrates the issue:

 

 

var CSRFToken;
var params = {
   ignoreSSLErrors: false /* BOOLEAN */,
   url: 'https://<Windchill Home>/servlet/odata/v2/PTC/GetCSRFToken()' /* STRING */,
   timeout: 60000 /* NUMBER */
};
// result: Text
CSRFToken = Resources["ContentLoaderFunctions"].GetText(params);
logger.debug("CSRF Token = " + CSRFToken);

 

 

Any advice/guidance would be appreciated.


Thanks,


Roy

3 REPLIES 3
barko
16-Pearl
(To:RGosline)

Windchill looks for the username to use to apply permissions to the dataset in the wt.effectiveUID passed in the request. In the OData Connector this is done through a script in the GetCustomHeaderParameters service. Article CS291231 has an example of the script to add.

RGosline
9-Granite
(To:barko)

The GetCustomHeaderParameters service on the OData Connector is already overridden with the script you mentioned.  I am still getting the error shown in my original post.  Any suggestions for next steps?

barko
16-Pearl
(To:RGosline)

I do not have any further suggestions. I recognized from your description that Windchill is looking for the attribute wt.effectiveUid, but that's about as much as I know about custom services. Perhaps another Community member can offer more.

Announcements


Top Tags