How to validate the SalesForce Consumer Key and Consumer Secret
Asked Answered
E

2

6

We have a system, where we want to push the records (e.g. Contact, Account, Opportunity) from our system to SalesForce.

To achieve this, we have used ForceToolKit for .Net. We are successfully pushing the contact records from our system to Salesforce.

First customer has to provide the consumer key and secret and upon providing these details, the user will be redirected to Salesforce login page for OAuth. We are storing the RefreshToken and it will be used at the time of Data push.

Here, if user provides incorrect consumer key, then it is redirecting to Salesforce login page and shows below message:

error=invalid_client_id&error_description=client%20identifier%20invalid

enter image description here

Now, we have to validate the Consumer key & secret before it redirects to Salesforce URL and check if it is valid or not.

Can anyone help me on how to achieve this?

Envelop answered 2/4, 2018 at 7:15 Comment(0)
N
1

As Aleander said, it's the first wrong endpoint URL and you need to consider additional things.

Instance = login for Production, and test for the sandbox.

URL - https://<instance>.salesforce.com/services/oauth2/token

Method - POST

Params -

  1. grant_type - password (hardcoded)
  2. UserName - Username which you may have
  3. Password - Here it's a bit tricky if you have IP enabled in the org for your user profile, then you need to append your security token with the password.
  4. Consumer Key - consumer key you're trying.
  5. Consumer Secret - Consumer secret you're trying.

You can check similar details in the below link as well -

Link - https://medium.com/@krissparks/postman-a-salesforce-rest-web-service-28edc0a69851

Nahshunn answered 16/9, 2020 at 3:50 Comment(0)
N
0

I understand your question so why the Error will be like mismatch of URL which you provided in Enpoint URL. This is first reson and next is consider the method post or get but main Reason is URL mis match intha URL you have to use request type. And consumer key secret key and username password this are the maditory to get the access token.

Nata answered 23/2, 2019 at 16:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.