简体   繁体   English

如何验证 SalesForce 消费者密钥和消费者秘密

[英]How to validate the SalesForce Consumer Key and Consumer Secret

We have a system, where we want to push the records (eg Contact, Account, Opportunity) from our system to SalesForce.我们有一个系统,我们希望将记录(例如联系人、客户、机会)从我们的系统推送到 SalesForce。

To achieve this, we have used ForceToolKit for .Net .为了实现这一点,我们在 .Net 中使用了ForceToolKit We are successfully pushing the contact records from our system to Salesforce.我们正在成功地将联系记录从我们的系统推送到 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.第一个客户必须提供消费者密钥和秘密,在提供这些详细信息后,用户将被重定向到 Salesforce 登录页面以进行 OAuth。 We are storing the RefreshToken and it will be used at the time of Data push.我们正在存储 RefreshToken,它将在数据推送时使用。

Here, if user provides incorrect consumer key, then it is redirecting to Salesforce login page and shows below message:在这里,如果用户提供了不正确的消费者密钥,则它会重定向到 Salesforce 登录页面并显示以下消息:

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

在此处输入图片说明

Now, we have to validate the Consumer key & secret before it redirects to Salesforce URL and check if it is valid or not.现在,我们必须在重定向到 Salesforce URL 之前验证消费者密钥和秘密,并检查它是否有效。

Can anyone help me on how to achieve this?谁能帮助我如何实现这一目标?

I understand your question so why the Error will be like mismatch of URL which you provided in Enpoint URL.我理解你的问题,所以为什么错误会像你在 Enpoint URL 中提供的 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.这是第一个原因,接下来是考虑 post 或 get 方法,但主要原因是 URL 与 URL 不匹配,您必须使用请求类型。 And consumer key secret key and username password this are the maditory to get the access token.和消费者密钥秘密密钥和用户名密码这是获取访问令牌的必要条件。

As Aleander said, it's the first wrong endpoint URL and you need to consider additional things.正如 Aleander 所说,这是第一个错误的端点 URL,您需要考虑其他事项。

Instance = login for Production, and test for the sandbox. Instance = 登录生产,并测试沙箱。

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

Method - POST方法- POST

Params -参数 -

  1. grant_type - password (hardcoded) grant_type - 密码(硬编码)
  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.密码 -如果您在组织中为您的用户配置文件启用了 IP,这里有点棘手,那么您需要将密码附加到您的安全令牌。
  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链接 - https://medium.com/@krissparks/postman-a-salesforce-rest-web-service-28edc0a69851

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从Salesforce获取消费者密钥和消费者秘密 - how to Get consumer Key and consumer Secret from Salesforce 如何在Twitter API中找到oaut_consumer_key? - How to find oaut_consumer_key in Twitter api? 如何使用 RabbitMQ 让消费者有弹性? - How to make consumer resilient with RabbitMQ? 如何在关闭连接和模型后正确完成 RabbitMq 消费者并等待 RabbitMq 消费者线程(库消费者回调)? - How to correctly finish RabbitMq consumer and wait to RabbitMq consumer threads (library consumer callbacks) after close connection and model? LinkedIn:“ OAuth请求中使用的令牌无效。 使用者密钥:“使用者密钥的值”” - LinkedIn “The token used in the OAuth request is not valid. consumer Key: 'value of consumer key' ” 如何反转/注入依赖性-MassTransit Consumer - How to invert/inject dependency - MassTransit Consumer 如何将 MassTransit 演示分为生产者和消费者应用程序 - How to separate MassTransit demo into producer and consumer applications 如何实现BlockingCollection来修复此生产者/消费者问题? - How to implement BlockingCollection to fix this Producer/Consumer issue? 如何在Kafka Consumer中处理多个记录? - How to handle multiple records in Kafka Consumer? 如何在没有响应的情况下对 MassTransit 消费者进行单元测试 - How to unit test MassTransit consumer with no response
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM