1

I've got a new named credential setup using an OIDC auth provider and the named principal type. It's authenticated successfully but when I try to call it I get

String namedCredential = 'callout:asdf';
HttpRequest req = new HttpRequest();
req.setMethod('GET');
req.setEndpoint(namedCredential + '/asdf/blah');
HttpResponse res = new Http().send(req);
System.debug(res);
System.debug(res.getBody());

I get the following error

18:15:34.272 (278743815)|EXCEPTION_THROWN|[5]|System.CalloutException: The callout 
couldn't access the endpoint. You might not have the required permissions, or the 
named credential "XXX" might not exist.

I'm using a system admin profile so was a bit surprised at first to get any errors. But no worries, I'll go add it. But when I try to add it to the profile there are no available named credentials to add to the profile.

So maybe it's just system admins not being custom profiles there are restrictions so i go to permission sets, but same thing. There are zero named credentials available to grant access to even though there are four in the org.

1 Answer 1

1

Named credentials with the "Named Principal" type seem to be available to all profiles (an untested assumption given they can't be added to profiles or permission sets).

In this case the named credentials was API_Dev and so when I used callout:API_DEV I got the following error. After correcting the case to callout:API_Dev everything worked as expected.

18:15:34.272 (278743815)|EXCEPTION_THROWN|[5]|System.CalloutException: The callout
couldn't access the endpoint. You might not have the required permissions, or the 
named credential "API_DEV" might not exist.

In summary, apex is case-insensitive, except when it's not. And named credentials fall into the case sensitive category.

2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .