September 8, 2016

UPVOTE - Ideas to get more out of Salesforce 'Named Credential' Feature !

Named Credential is a great feature to simplify authentication and API endpoint management in Salesforce, specially when OAuth is involved. One doesn't needs to get into technicals of:

  1. Getting OAuth Access Tokens.
  2. Refreshing the same. 
  3. Storing the same safely.
  4. Lastly using the same in an easy way.
Named credentials work really well for a single user scenario, where that user can go and authorise Salesforce to store their access tokens, and let any apex code use the same without much hassle. 

Though it becomes tricky when we are developing a multi user sync solution based on Named Credentials i.e. 

  • Lets assume we are syncing Google Tasks with Salesforce
  • Each user will authenticate themselves via "My Settings > Authentication Settings for External Systems"
  • Lets say we want an automated batch job to run every night or at a configured time by admin, which will sync all the tasks for all Salesforce users with Google counter parts.
  • This can't work as of now, because Named Credentials inherently work for the logged in API user only. Thus who ever scheduled the nightly run or batch job, we can only sync up tasks for the same. 
This last limitation is a show stopper for me in a recent project, and I had to give up on Named Credentials and do my own OAuth stuff. 

I posted the same on Idea Exchange, please up-vote the idea so that we can make more good use of this feature. 

Here is list of all Named Credentials related idea, which you might want to review and up-vote:


Related open Stack Exchange questions:

Here are some open stack exchange questions about Named Credentials to review:
  1. http://salesforce.stackexchange.com/questions/139736/using-named-credentials-in-batch-job-multi-user
  2. http://salesforce.stackexchange.com/questions/139584/named-credentials-refresh-token-google-apis