Got a response from Premier Support suggesting to change the DotNET framework to 4.6 or higher, as they think it's to do with the depreciation of TLS 1.0 & 1.1. We're running tests now.
SP Online App Authentication failing with "Token Request Failed" error
We had SP App for SPOnline which is working fine earlier. But now suddenly few customers are getting "Token Request Failed" when app authentication validated via CSOM.
Is there any change in Microsoft Authentication Model recently?
Below stack trace message
An unexpected error has occured. Details of the problem are: Token request failed., Stack trace: at Microsoft.IdentityModel.S2S.Protocols.OAuth2.OAuth2S2SClient.Issue(String securityTokenServiceUrl, OAuth2AccessTokenRequest oauth2Request) at TokenHelper.GetAppOnlyAccessToken(String targetPrincipalName, String targetHost, String targetRealm)
We checked App Client Secret not expired.
Any help is much appreciated. Thanks in advance
4 answers
Sort by: Most helpful
-
-
NigelH 11 Reputation points
2021-05-20T10:28:21.6+00:00 I've been experiencing the same sort of issue since 22 April, in 3 separate applications, and have yet to find a resolution. Support ticket has been open with Microsoft for a week now with no progress. My errors are:
SharePointPnP.IdentityModel.Extensions.S2S.Protocols.OAuth2.OAuth2S2SClient.Issue(String securityTokenServiceUrl, OAuth2AccessTokenRequest oauth2Request)
The remote server returned an error: (401) Unauthorized. at System.Net.HttpWebRequest.GetResponse() at SharePointPnP.IdentityModel.Extensions.S2S.Protocols.OAuth2.OAuth2WebRequest.GetResponse() at SharePointPnP.IdentityModel.Extensions.S2S.Protocols.OAuth2.OAuth2S2SClient.Issue(String securityTokenServiceUrl, OAuth2AccessTokenRequest oauth2Request)
-
Muhammad Altaf 1 Reputation point
2021-06-14T03:08:06.303+00:00 Hi NigelH,
I am also facing same issue. my application is running on windows server 2019. and it works on local pc but does not work on the server as previously was working suddenly stop working. -
John Guilbert (Housing) 1 Reputation point
2023-08-10T17:15:27.6833333+00:00 I have same issue after coming back from holiday. Debug on local machine I get this, but it works fine on Live Production as Azure App Service. Did anyone resolve?