Use of Named Credentials seem to be tied to External Data Source

I’m looking into using Named Credentials (spring ’15) to simplify apex callouts to an external web service. I actually thought, based on the documentation, that this would help, and I’m referring correctly to the Named Credential in my code and have also given my profile access to the NC, but I’m faced with this error when I do the callout:

System.UnexpectedException: You don’t have permission to view this
data. Ask your administrator to set up authentication for the external
data source

This seems to say that NC are tied to the use of External Data Source, which is absolutely unrelated to what I want to do, and the documentation doesn’t mention that they are a requirement. Have any of you run into this error when testing out Named Credentials?


The error occurs if your named credential is configured to use per-user authentication but the currently logged in user that is trying to use the named credential (or their administrator) has not added their credentials to the Authentication Settings for External Systems section (located under My Settings) for that named credential.

The error message mentions external data sources because under the hood, the features share a lot of the same code. But it is confusing, and a bug.

Source : Link , Question Author : akarnid , Answer Author : Lawrence McAlpin

Leave a Comment