Why do I get an HTTP 401 error?

Why do I get an HTTP 401 error?

Additionally, you receive an HTTP 401 error message when you are directed to the add-ins. PHAs may include an externally hosted web application, service, database, or SharePoint component.

How to fix provider hosted add-in in SharePoint?

To restore SharePoint add-in functionality, register the provider-hosted add-ins by using the RegisteredIssuerName value that contains the new realm ID. Then, reapply the add-in permissions for each add-in instance. To repair authentication-related issues that are associated with provider-hosted add-ins and hybrid features, follow these steps:

When does Azure give 401 Unauthorized access to SharePoint?

I created a trial tenant on 25/8 and deployed my custom solution that uses app-only principals to do requests to SharePoint. It has a timer Azure Function running every hour and it worked fine until about 26/8 11pm UTC. After that it has only given the 401 unauthorized.

Why is my provider hosted add-in not authenticating?

The actual RegisteredIssuerName value is IssuerId@OldAuthRealmGuid, in which the oldAuthRealmGuid value no longer matches the current AuthRealmGuid value. The add-in fails to authenticate because the STS can’t find a matching token issuer.

Can a PHAs be an externally hosted service?

PHAs may include an externally hosted web application, service, database, or SharePoint component. This problem does not exist if you configure hybrid features first, and then deploy provider-hosted add-ins and/or Workflow Manager in a SharePoint 2013 or SharePoint 2016 farm.

From that, one place to start is looking at the credentials you configure for the anonymous user. If they are incorrect (if perhaps the user password was changed elsewhere) you will get an HTTP 401. Make sure your directory permissions are also set to allow everyone read access.

When do you need permission to access a site?

Grant the user permissions back to the file or site. This issue most frequently occurs when a user is deleted and re-created with the same user principal name (UPN). The new account is created by using a different Unique ID value.

What causes a user to be denied access to a site?

This issue most frequently occurs when a user is deleted and re-created with the same user principal name (UPN). The new account is created by using a different Unique ID value. When the user tries to access a site collection or their OneDrive, the user has an incorrect ID.

How to return a 401 / unauthorised response in ASP.NET?

Even in our logging DelegatingHandler we can see that the response is 500, not 401. You should be throwing a HttpResponseException from your API method, not HttpException: var msg = new HttpResponseMessage (HttpStatusCode.Unauthorized) { ReasonPhrase = “Oops!!!”