9

I am trying to build Salesforce to Salesforce integration using Named Credentials.

Followed steps from below blog.

http://www.jitendrazaa.com/blog/salesforce/salesforce-to-salesforce-integration-using-named-credentials-in-just-5-lines-of-code/

  • Created Connected App in destination org
  • Created Authorization Provider in source org
  • Defined Named Credential in source org.

    HttpRequest feedRequest = new HttpRequest();
    
    feedRequest.setEndpoint('callout:Dev3Org/services/data/v32.0');
    
    feedRequest.setMethod('GET');
    
    Http http = new Http();
    
    HTTPResponse feedResponse = http.send(feedRequest);
    

When I ran above code in Source Org (anonymous window) then am getting below error

Session expired or invalid

4

when I checked Generate Authorization Header check box on Named Credential then error went off.

enter image description here

  • hey, where is the above option in salesforce dashboard? – Sujal Patel Jan 3 '18 at 14:05
0

Named credentials works fine. It looks like request is reaching the host and you are getting the response as session expired. In Named Credentials you can set basic authentication or oauth please check which one of them are being used.

  • I have specified OAuth 2.0 in Named Credentials – sfdc Dec 15 '15 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.