[SalesForce] Is it necessary to provide consumer key and consumer secret to get access token/make API call

I am trying to update contact record in Salesforce via API call. I got the access token first by providing username, password, consumer key, consumer secret, grant_type. Then I used the access token and made the second call which is the actual API call to update contact.

My question is is it possible to update contact/get access token just with username, password without really providing the consumer key and consumer secret or we definitely need consumer key and consumer secret to get access token/update a record in Salesforce.

This is the API I am trying to access:

https://mydomain/services/data/v36.0/sobjects/Contact/Id/003AU00000MhW3WQAV

Thanks

Best Answer

Is it must to provide consumer key and consumer secret to get access token/make API call

Yes. But only to get access token. Once you have the access token, you don't provide the consumer key/secret in subsequent API calls.

You should take a look and understand how authentication works in case of REST API, documented at Understanding Authentication.

Before making REST API calls, you must authenticate the application user using OAuth 2.0.

And that when you authenticate using OAuth 2.0, the pre-requisite is to have a Connected App by which you will be able to get the Consumer Key/Secret and utilize it further for authentication and getting the access token using your preferred authentication mechanism.