SharePoint 2013 Workflow – App Permissions using java script

I have created a SharePoint 2013 workflow and using App Step in the workflow, I have saved the site as a template and created a new site using the JavaScript object model. The SharePoint 2013 workflow App Step was not working fine until I manually enable the App Step trust in the newly created site.

I am creating the site from site template using JavaScript object model and someone help in enabling the App Step trust using the JavaScript object model.