All Collections
Problem analyzers
Connected apps must have a unique consumerKey
Connected apps must have a unique consumerKey

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

David Runciman avatar
Written by David Runciman
Updated over a week ago

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

If you’re trying to deploy a connected app, you might come across a Gearset 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

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 isn't 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.

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.

Did this answer your question?