How do I implement data connector for SPFx web part that uses data from a SP list in another site?

Copper Contributor

I have been looking at migrating an existing web part that uses data from a list deployed to a specific subsite in a site collection. I want to extend this so that credentials can be supplied at render time to access this site collection, so that while testing, even if the webpart is deployed locally, or on my "test" site, I can point it to live data to render.

Is this possible?

And if so, what is the best approach? I tried using sp-pnp-js but I can't find how to do the authentication part prior to making the query for the list data. Any help or guidance would be greatly appreciated.

- Nissan

1 Reply
Interesting scenario. Are you saying that if you run your solution as localhost you would like to work with live data from SharePoint? I have created a SharePoint add-in (sharepoint hosted) that uses an iframe to connect to localhost and then I use the sp.requestexecutor.js to talk to SharePoint in the context of the add-in. Have a look at this What are you thoughts on this approach?