Can I create connected apps programmatically?

Is there a way to define connected apps w/o opening the UI? Has anyone already created apps like that? Any advice would be appreciated!!

Answer

Update: As of version 32 you can now supply your own ConsumerKey and ConsumerSecret when creating a Connected App.

You can use the Salesforce Metadata API to create a Connected App, it provides the ConnectedApp metadata type for this purpose. You can either use the File Based method or the CRUD method (preferable for programatic creation).

Represents a Connected App application. A connected app is an application that integrates with salesforce.com using APIs. Connected apps use standard SAML and OAuth protocols to authenticate, provide Single Sign-On, and provide tokens for use with Salesforce APIs. In addition to standard OAuth capabilities, connected apps allow administrators to set various security policies and have explicit control over who may use the applications. It extends the Metadata metadata type and inherits its fullName field.

ConnectedApp components have the suffix .connectedapp and are stored in the connectedapps folder.

This API is available in any language supporting HTTP callouts using Web Services (Salesforce provides a WSDL to consume in your client app). If your using a Java, there is a prebuilt client library available here. There is also an Apex wrapper around the API if your interested in doing this natively.

Attribution
Source : Link , Question Author : user7053 , Answer Author : Community

Leave a Comment