SPFx in SP2016-OnPrem: Get/Post not working across web applications in same SharePoint Farm

Copper Contributor

Need to access the list items where SPFX webpart is deployed in one SharePoint 2016 application (https://abc.sharepoint.com) and list is present in another SharePoint application (https://mysite.sharepoint.com) in same SharePoint 2016 server farm with same credentials.

SharePoint version: 2016 on-premise

SPFX: 1.1

Tried: used "@pnp/sp-addinhelpers" and @pnp/sp.


import { sp, SPRequestExecutorClient } from "@pnp/sp-addinhelpers";

function getitemfromotherdomain(){


    sp: {

        fetchClientFactory: () => {

            return new SPRequestExecutorClient();




const  addInWebUrl= "https://abc.sharepoint.com/";

const hostWebUrl = "https://mysite.sharepoint.com/";

// make requests into the host web via the SP.RequestExecutor

sp.crossDomainWeb(addInWebUrl, hostWebUrl).get().then(w => {


    console.log(JSON.stringify(w, null, 4));



Source : https://pnp.github.io/pnpjs/sp-addinhelpers/docs/sp-rest-addin/ 

calling the Function:

    const script1 = document.createElement("script");


    script1.async = true;



Error occured: Failed to load resource: the server responded with a status of 403 (Forbidden) on calling of


error expanded:

<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">

<m:code>-1, Microsoft.SharePoint.SPException</m:code>

<m:message xml:lang="en-US">There is no app context to execute this request.</m:message>


(index):1 Uncaught (in promise)

  1. Response
    1. body: ReadableStream
      1. locked: false
      2. __proto__: ReadableStream
    2. bodyUsed: false
    3. headers: Headers
      1. __proto__: Headers
    4. ok: false
    5. redirected: false
    6. status: 403
    7. statusText: "Forbidden"
    8. type: "default"
    9. url: "
    10.  __proto__: Response
0 Replies