1

I am developing an app and this app is authenticated using OAuth2. Where do you I store the OAuth access and refresh tokens in Salesforce? Is Custom Setting the best approach ? Also, how do i store tokens of multiple users.

1 Answer 1

0

Yes custom setting will be best option here.

Hierarchy__c CS = Hierarchy__c.getInstance(userinfo.getuserId());
System.Assert(CS.Accesstoken__c== '******');

You can create a Hierarchical type custom setting and based on user can create data there. Because query on custom setting does not count against SOQL governor limit so it will help you in limits as well.

4
  • What about using a list custom setting? Are there disadvantages to that?
    – akcorp2003
    Nov 2, 2016 at 16:27
  • @akcorp2003 there is no disadvantage but normally in this scenario we use Hierarchical CS because here you can create record for user basis and easily get them using the code I have posted. Nov 3, 2016 at 5:08
  • So is this the only way or are there better ways ? Nov 3, 2016 at 9:02
  • @Ranga I think in your use case its best way but not the only way. You can still use list CS or Object. Nov 3, 2016 at 9:07

You must log in to answer this question.

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