+ Start a Discussion
Scott McArthur 8Scott McArthur 8 

Calling REST web service using OAuth 2 from Apex

Any good examples of callling a rest web service using OAuth 2 from Apex?
Anders NielsenAnders Nielsen
Amit's reply addresses a different issue - how to call INTO Salesforce.

First, it is good to know that web service calls out of Salesforce are referred to as callouts. Once you know this, searching online for help on this topic becomes much easier.

If you want to do it programmatically because you need full control, you can use this approach: https://developer.salesforce.com/forums/?id=9060G0000005WnGQAU

If you are connecting to a standard OAuth2 provider, try looking in to Named Credentials. Then Salesforce will handle the OAuth part for you.