BlacklistedConsumer represents a connected app that is inaccessible to a Salesforce org's users. It controls connected-app access; it is not the ConnectedApp definition itself. Blocking an app ends all current user sessions for that app and prevents future sessions, so its effect extends beyond denying new sign-ins.
The blockedByApiWhitelisting setting requires particular care: setting it to true applies an administrator-preauthorization policy to all connected apps in the org, not just the app identified by the component. Its effect depends on the profiles and permission sets authorized for each app and assigned to users.
Key Elements
| Element | What the Element Controls |
|---|---|
blockedByApiWhitelisting |
Boolean. true applies the Permitted Users policy "Admin approved users are pre-authorized" to all connected apps in the org. false is the default and is documented as allowing access to the connected app. |
consumerKey |
Required. Identifies the OAuth consumer; this is the OAuth 2.0 client_id. It must be globally unique and contain 8-256 alphanumeric characters, with no spaces or special characters. It cannot be edited after it is defined and saved. |
consumerName |
Required. References the associated ConnectedApp by name. |
masterLabel |
Required. Supplies the primary label for the connected app record. It does not replace the OAuth identity in consumerKey. |
fullName |
Inherited from Metadata. Identifies the metadata component, not the OAuth consumer. |
Behavior and Constraints
blockedByApiWhitelisting is not simply an unconditional deny flag. When it is true, access is limited to users assigned an associated profile or permission set authorized for the app. Although a BlacklistedConsumer component identifies a particular app, the documented scope of this policy is all connected apps in the org.
When blockedByApiWhitelisting is false, the documented behavior is to allow access to the connected app. That value does not establish that a user satisfies every other applicable access requirement.
Blocking an app terminates its existing user sessions as well as preventing future sessions. For protection against malicious attempts to access org data, Salesforce recommends API Access Control rather than relying on individual app blocking. API Access Control restricts Salesforce API access to users preauthorized through an approved connected app.
Deployment and Retrieval
BlacklistedConsumer components use the .blacklistedConsumer suffix and are stored in the blacklistedConsumers folder. In package.xml, use BlacklistedConsumer as the metadata type name. The documented manifest example uses * as the member selector.
A component definition must supply consumerKey, consumerName, and masterLabel. The consumer key must meet the length, character, and global-uniqueness constraints described above.
An existing component cannot be retargeted to another OAuth client by editing consumerKey: that value is immutable after it is defined and saved. Keep the identities distinct when matching retrieved components to apps: fullName identifies the metadata component, consumerName names the connected app, and masterLabel provides its label. None replaces consumerKey as the OAuth client identifier.
Relationships
The direct app reference is through consumerName. Profile and permission-set assignments also matter when evaluating the preauthorization policy, but those assignments are not fields on BlacklistedConsumer.
References
-
ConnectedApp:consumerName.
Common Questions
Does blockedByApiWhitelisting=true block every user from the app?
No. It applies the "Admin approved users are pre-authorized" policy to all connected apps in the org. Access depends on whether users have a profile or permission set authorized for the app.
Does blockedByApiWhitelisting=false guarantee that a user can access the app?
No. Although false is documented as allowing access and is the default, it does not establish that the user meets other applicable access requirements.
Can I change consumerKey to point to a different connected app?
No. Once consumerKey is defined and saved, it cannot be edited. It is the OAuth client_id, not the component's fullName or its label.
Where are BlacklistedConsumer files stored, and how do I select them for retrieval?
They are stored in blacklistedConsumers with the .blacklistedConsumer suffix. Use the type name BlacklistedConsumer in package.xml; the documented manifest example uses the wildcard member *.
Will blocking a connected app end existing sessions?
Yes. Blocking ends all current user sessions for the app and prevents future sessions. For protection against malicious API access, Salesforce recommends API Access Control rather than relying on individual app blocking.