+ Start a Discussion

How to a make Salesforce connect TO a third party API with Oauth2?

This has been asked several times but it looks like it's only been answered incorrectly by people who don't speak english and have been misinterpretting the question.

I want to write an APEX script to query a third party API. 
  • The apex code making the request is in Salesforce
  • Salesforce retrieves an Oauth token from the target host
  • The code in Salesforce executes an api command
  • The target host responds with information.
  • The apex code that made the request stores the information somewhere.
Does Salesforce have a component to automatically maintain Oauth tokens? If so, how do I access it?

This has NOTHING to do with the Salesforce API. This has NOTHING to do with Connected Apps. This has NOTHING to do with SSO. Please do not copy/paste bad answers.