使用VS Code部署Connected App - Connected apps must have a unique consumerKey

精华摘要】:由于原文过于优秀,为保证原汁原味的阅读体验,请看完精华摘要后也享受下原文带来的冲击感!

使用vs code成功部署connected app,需要调整两项:

#1. callbackUrl - 以做SSO为例,填写Auth. Provider的Callback URL
#2. consumerKey - 清除 (该字段不可写,部署后会自动生成)

Deploying a connected app is more likely to succeed if the unique consumerKey is not deployed

This problem analyzer makes it possible to deploy connected apps with unique consumer keys between orgs.

If you’re trying to deploy a connected app between orgs, you might come across a Gearset 'suggested fix' problem analyzer that warns: 

Connected apps must have a unique 'consumerKey', and once set this value is not writable. Attempting to deploy 'consumerKey' as part of a connected app will usually cause the deployment to fail.

What triggers this problem analyzer?

If your connected app uses OAuth, then a unique consumer key is required - a value used by Salesforce to identify individual consumers. For those familiar with OAuth 2.0, this consumer key is an OAuth client_id

使用VS Code部署Connected App - Connected apps must have a unique consumerKey

If you create a connected app in Salesforce, a consumer key is generated automatically. These consumer keys are unique. Once set, they are no longer writable; Salesforce doesn’t let you edit or overwrite them.

As a result, it is not possible to deploy a consumer key from one org to another. Attempting to do so will trigger the Gearset problem analyzer, warning you that the deployment of your connected app is likely to fail.

使用VS Code部署Connected App - Connected apps must have a unique consumerKey

How does Gearset help?

There’s an easy fix to this problem: don’t deploy the consumer key with your connected app. If you already have the connected app in your target org, the consumer key there will be left unaltered, and OAuth will continue to work as before. If the target org doesn’t include the connected app, Salesforce will generate a consumer key automatically - just as it does when you create a connected app manually.

Gearset suggests this fix when it detects a consumer key in your deployment. Simply leave the box checked and continue with the deployment.

上一篇:数组去重的几种方法


下一篇:js操作数组