0

I'm trying to make REST callouts from Salesforce to Sharepoint and I'm getting an "Invalid issuer or signature" response from my code. I tried generating a self-signed certificate on Salesforce and uploading the .crt file in my Sharepoint app, but the same error message still persists. Is there something I'm missing here?

Something else I don't understand is that when I upload the Salesforce certificate using the "Upload Public Key", I get a Private Key type generated for that public cert with a private key number. Maybe this a mislabeling on the App Registration Portal itself?

Salesforce Apex REST code:

public class AuthCallout {
   public static void basicAuthCallout(){
     HttpRequest req = new HttpRequest();
     req.setMethod('GET');
     req.setEndpoint('callout:Sharepoint_Online/_api/web/list');
}
}

The Sharepoint_Online Named Credential uses the self-signed certificate and Oauth2.0 with the "Files.Read.All Sites.Read.All offline_access" scope. The authentication status says Authenticated, so I know that part is fine. From SF, I downloaded the public .crt file and reuploaded it to my registered app in "apps.dev.microsoft.com".

6
  • Maybe you haven't set the correct permissions in the SharePoint App... Anyways, you should give more information when you create a question. Is hard to help with that info
    – Mikel
    Commented Jun 18, 2018 at 21:33
  • I gave Files.Read.All and Sites.Read.All permissions for the app. What more information are you looking for? I followed the steps for 'offline_access' too and those are properly referenced in the Salesforce scopes. Microsoft isn't terribly verbose in their REST API errors, so it's hard for me to pinpoint the issue myself. Commented Jun 18, 2018 at 21:34
  • How you made your app, wich steps you followed... code... things you think it can help. The call to the API... I am not pretty sure where you are adding those permissions, but at least in azure Portal, after adding permissions, there is a button at top that says something like "Grant permissions". Maybe you missed that
    – Mikel
    Commented Jun 18, 2018 at 21:41
  • Done. I added these permissions via the app I registered in the Application Registration Portal under "Application Permissions" and "Delegated Permissions" Commented Jun 18, 2018 at 21:48
  • Fine! add the answer and mark it as correct or I do, so it appears as resolved question :)
    – Mikel
    Commented Jun 19, 2018 at 20:45

1 Answer 1

0

Changing my Named Credential URL to point to Microsoft Graph and then my Sharepoint Tenant now gives me a 'Bad Request' "Inner Error", so it appears to have worked in getting me inside Sharepoint Online.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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