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.
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.