function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Evan KennedyEvan Kennedy 

Storing OAuth Credentials for 3rd Party Apps

Hello,

I've got a google script that I'd like to call using an Apex callout from Salesforce.

Now, I know how to implement OAuth authentication into this app. My question is this: is there a native way to store the tokens (refresh, access), or is this something I'd need to do with a custom object or custom setting?
VineetKumarVineetKumar
Use Custom Setting
Evan KennedyEvan Kennedy
Is that the only way? I notice there is an "OAuthToken" table in the Salesforce database that has all these fields on it (see image).User-added image
Evan KennedyEvan Kennedy
That image is hard to see, here is a query that has all the fields of this table.

select AccessToken, AppMenuItemId, AppName, CreatedDate, DeleteToken, Id, LastUsedDate, RequestToken, UseCount, UserId from OauthToken
VineetKumarVineetKumar
The OAuth Object represents an OAuth access token for connected app authentication and can be used to create a user interface for token management. Means it is used to store OAuth details for salesforce app, but since you app is s 3rd party app, you cannot store the details in this object.

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_oauthtoken.htm

Let me know if this helps by marking it as the best answer.
Thanks!