node-sp-auth
node-sp-auth copied to clipboard
Crash in OnpremiseUserCredentials
trafficstars
If the server returns an error, sometimes it doesn't send the authentication header. Here's an example response that triggers a crash in https://github.com/s-KaiNet/node-sp-auth/blob/master/src/auth/resolvers/OnpremiseUserCredentials.ts#L56
{
"statusCode": 400,
"body": "The length of the URL for this request exceeds the configured maxUrlLength value.",
"headers": {
"server": "Microsoft-IIS/8.5",
"sprequestguid": "9f0c959e-449b-809b-6dd5-552e75b53cfc",
"request-id": "9f0c959e-449b-809b-6dd5-552e75b53cfc",
"x-frame-options": "SAMEORIGIN",
"x-powered-by": "ASP.NET",
"microsoftsharepointteamservices": "15.0.0.4841",
"x-content-type-options": "nosniff",
"x-ms-invokeapp": "1; RequireReadOnly",
"date": "Thu, 04 Oct 2018 10:26:16 GMT",
"content-length": "81"
},
}
Could you please elaborate?
From my understanding, if a server returns an error during the authentication phase, the process should be aborted.
Actually the problem is that the authentication header is missing in this response, and that will make the header parser throw an error, and then the original http error is gone.
I had to do some deep debugging to see that my url was too long...