Manage Access Through a Custom Connected App Handler
Write a custom connected app handler in Apex to customize how the connected app is invoked. The custom handler can support new protocols or respond to user attributes in a way that benefits a business process.
Required Editions
| Available in: both Salesforce Classic and Lightning Experience |
Connected Apps can be created in: Group, Essentials, Professional, Enterprise, Performance, Unlimited, and Developer Editions Connected Apps can be installed in: All editions |
| User Permissions Needed | |
|---|---|
| To read, create, update, or delete connected apps: | Customize Application AND either Modify All Data OR Manage Connected Apps |
| To update all fields except Profiles, Permission Sets, and Service Provider SAML Attributes: | Customize Application AND either Modify All Data OR Manage Connected Apps |
| To update Profiles, Permission Sets, and Service Provider SAML Attributes: | Customize Application AND Modify All Data AND Manage Profiles and Permission Sets |
| To rotate the consumer key and consumer secret: | Allow consumer key and secret rotation |
| To install and uninstall connected apps: | Customize Application AND either Modify All Data OR Manage Connected Apps |
| To install and uninstall packaged connected apps: | Download AppExchange Packages AND Customize Application AND either Modify All Data OR Manage Connected Apps |
See New connected apps can no longer be created in Spring ‘26 for more details.
- From Setup, in the Quick Find box, enter Connected Apps, then select Manage Connected Apps.
- Click Edit next to the connected app that you're configuring access for.
- Under Custom Connected App Handler, enter the name of the Apex Plugin class you created to customize the behavior of the connected app.
- For Run As, select a user account to be the execution user. The plug-in runs as the
execution user on behalf of the current user of the connected app. Depending on the methods
used in your
ConnectedAppPluginApex class, you can sometimes leave this field blank.- If your Apex class uses the
authorize,modifySAMLResponse, orrefreshmethods, specify an execution user in the Run As field. - If your class uses only the
customAttributesmethod and doesn't use any otherConnectedAppPluginmethods, you can optionally leave the Run As field blank. The plug-in then runs as an Automated Process User, which is a system user that executes tasks behind the scenes.
For more information, see theConnectedAppPluginclass in the Apex Reference Guide. - If your Apex class uses the
- Save your settings.

