3

My managed package Apex code is making callouts but I can't use a packaged Named Credential as the user also needs to be able to adjust the endpoint URL not only the username and password.

I planned on using per-user named-credentials (with a predefined name or label) for that but now I am unable to query / find out. There is no User field on Named Credential that I can SOQL.

Who am I supposed to access it then?

1 Answer 1

3

I know it doesn't directly address how to do this with Named Credentials, but I've historically used protected hierarchy custom settings for this in a managed package.

Being a hierarchy allowed for both default org level values and then user specific values if required.

It does require more work as the Named Credential won't do it for you. However, it gives you full control of the endpoint URL and the credentials that are passed to it.

2
  • 2
    Yup, NamedCredential isn't a good fit for this half-way use case.
    – identigral
    Commented Apr 4, 2019 at 19:09
  • @Daniel Ballinger -- I agree with you on this. Named Credentials just don't work with managed packages very nicely. One question though--without a named credential, where do you get your Consumer Secret/Key?
    – DaveS
    Commented May 9, 2019 at 21:42

You must log in to answer this question.

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