How to automatically create an OAuth 2 integrated application record during the installation process of the marketplace app which we are developing.
After creating this entry, how do we read the generated client id and secret from this record in a business process? Help with code is appreciated. Thanks.
Like
Even if you execute SQL script during the the marketplace app package installation that will perform the direct INSERT into OAuthClientApp you won't be able to call
/0/rest/AdministrationService/UpdateOrCreateTechnicalUser - to create a technical user for this OAuth application if needed
/0/rest/OAuthConfigService/GetClientSecret - to generate the client secret for the created OAuth app
So this part can be specified in the manuall on how to work with the marketplace app so that users could create the OAuth application on their own and then specify it as a value of the custom system setting (of a lookup type referencing the "OAuth client application" object). The system setting can be bound as data to the package and it will be created in the app to which the package is installed. Then you can use this system setting to get the ID of the record in the OAuthClientApp entity and then read client Id and secret using either server ESQ or SelectQuery class or simple read data element.