I am attempting to call the Salesforce REST API from a Lightning Component. As per their documentation I have set up a named credential using the following settings:
Label: Salesforce REST Name: SFDC_REST URL: https://na39.salesforce.com Certificate: null Identity Type: Named Principal Authentication Protocol: Password Authentication Username: <my_username> Password: <my_password> Generate Authorization Header: true Allow Merge Fields in HTTP Header: false Allow Merge Fields in HTTP Body: false
All callouts made using this named credential return a 401 response with
INVALID_SESSION_ID. I have seen other posts about using a custom merge header for OAuth but I am attempting to use basic auth here. I don't think I can generate my own basic auth header because I can't base64 encode the username/password.
Any insight on why the named credential is failing to authenticate? It seems like this should just be point-and-click setup and that I should just be able to reference the named credential in my endpoint as