• Platform cache : I am using platform cache but platform cache is not returning anything after very small period of time ( approx 30 sec- 60 sec ).
  • Custom Setting : Custom setting has a limitation of fields can be created max 255 character. Access tokens are more than that.
  • Custom Object : Custom Object won't be good solution i think considering it's sensitive data.
  • Custom Metadata : I am not sure.

Any Idea what would be the best approach?


If possible, use Named Credentials. You don't need to manage the Access Tokens or Refresh Tokens at all, as the platform does it for you, and securely stores the tokens in a way that's non-trivial to retrieve, even for administrators. Also, feel free to read Secure Coding: Storing Secrets for other alternatives. Custom Metadata Types is also a viable solution.

  • Thank You for providing all the valuable information. I have implemented Named credentials for username password but not for oAuth2.0. I will go through the attached links to resolve the issue. – Salesforce Development Dec 13 '19 at 19:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.