I have a scenario where a user has some data related to him in a SP on premises site (site1), but he doesn't have access to site1. The user is having access to another site2 where we want to have webpart/page to show him data related to him from site1.
We want to use SharePoint REST or CSOM from browser to query data from site1 while user is logged into site2. We will have the username and password of some user from site1 in webpart config that will be used to fetch data from site1. I see many examples where credentials are used to login to CSOM from server side C# code but not any where this is done from browser side JavaScript.
Please tell is this is possible either using REST or CSOM from Javascript. Or is there another way of achieving this. Ideally we want this to be reusable from SPOnline scenario as well.
Thanks.