Вопрос

I'm working on a little SP On-Premises 2016 project.

I have to make several request to different Site-Collections in the farm. I'm making those requests with an Ajax-Call inside a Script-Editor Webpart.

Some users may not have the rights to access those SiteCollections, yet I don't want the requests to fail. Therefore I'm also sending a Basic-Auth-Header. (cheap but it works.)

The problem: After the successful request, I'm now logged in as the specific user I sent in the header.

How can I send those credentials only once, and prevent being logged in as that user after the request?

Это было полезно?

Решение

You need a middle-tier or farm solution (WSP) to do this properly. You don't want to embed credentials into the script editor webpart, of course. What you can do is call an endpoint (middle tier) which possess the necessary rights.

You will want to look into creating a SharePoint Addin (i.e. CSOM solution) to prevent the middle-tier from being called by an anonymous request.

Другие советы

When making request to different Site-Collections using api, we need to get other site FormDigestValue then add to request header.

enter image description here

You could refer to this: https://social.msdn.microsoft.com/Forums/aspnet/en-US/f52d252e-538a-4d56-ad89-2a23c57abf34/update-list-in-different-site-collection-using-the-api?forum=sharepointdevelopment

Лицензировано под: CC-BY-SA с атрибуция
Не связан с sharepoint.stackexchange
scroll top