0

How to get the access_token to call the Apex REST service from outside using the Rest Client ?

I have a connected App and that gives me

Consumer Secret : 1180XXXXXXXXXX

Consumer Key  : MVG9d8..z.hXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

enter image description here

When I used below URL, I got the error:

https://ap5.salesforce.com/services/oauth2/token?client_id="3MVG9d8..z.hDcPJZPIzGJ5UZDuKCOqbHXXXXXXXXXXXXXXXXXXXXX"&
client_secret="11805XXXXXXXXXX"&username="UserName"&password="Password-SecurityToken"&grant_type=password

when I used below, I see the error, why ???

enter image description here

Whats wrong I used with username and password ?? Why its saying invalid client id ?

Yes I tried with below as well

https://ap5.salesforce.com/services/oauth2/token?client_id="3MVG9d8..z.hDcPJZPIzGJ5UZDuKCOqbH8CCGCPnmwQuRbwLZ_2f.thbqWMX82H7JRGx4
6VYyEkuwzQ9._ww5"&client_secret="1180508865211885204"&username="pXXXXXXXXXXXXXXX.com"&password="AgXXXXXXXX"&grant_type=password

Here I put my actual username and password which I used to login into the Production salesforce org. Please guide.

::::::UPDATED POST::::

Now this is final URL:' Still it says

https://ap5.salesforce.com/services/oauth2/token?client_id="3MVG9d8..z.hDcPJZPIzGJ5UZDuKCOqbH8CCGCPnmwQuRbwLZ_2f.thbqWM
    X82H7JRGx46VYyEkuwzQ9._ww5"&client_secret="1180508865211885204"&username="pXXXXXXXX@xy.com"&
    password="testingme@1000Z9qVpytemh3Q7kPmU3pLEZFH"&grant_type=password

enter image description here

1

Did you add your username and password with a security token to the url variables that call for them? From your url it looks like you just have "Username" and "Password" where the variables should be.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.