Activity › Forums › Salesforce® Discussions › How to assign Connected App to any desired profile programatically by using apex or metadataapi in Salesforce?
Tagged: Apex, Components, Salesforce APIs, Salesforce Apps, Salesforce Connected Apps, Salesforce Metadata, Salesforce.com, Web Services
-
How to assign Connected App to any desired profile programatically by using apex or metadataapi in Salesforce?
Posted by Prachi on December 9, 2019 at 6:21 PMHow to assign Connected App to any desired profile programatically either by using apex or metadataapi?
Deepak replied 6 years, 6 months ago 2 Members · 1 Reply -
1 Reply
-
You can use the Salesforce Metadata API(http://www.salesforce.com/us/developer/docs/api_meta/) to create a Connected App(https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_connectedapp.htm), it provides the ConnectedApp metadata type for this purpose. You can either use the File Based method(https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_file_based_calls_intro.htm) or the CRUD method(https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_crud_based_calls_intro.htm) (preferable for programmatic 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 connected apps 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 you’re using a Java, there is a prebuilt client library available here(https://developer.salesforce.com/page/Introduction_to_the_Force.com_Web_Services_Connector). There is also an Apex wrapper(https://github.com/financialforcedev/apex-mdapi) around the API if you’re interested in doing this natively.
Hope this helps.
Log In to reply.