function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Richard ScottRichard Scott 

Auto ORG Provisioning via API SignUpRequest - Get API Token automatically for the defined admin of new ORG

I am working on a project where I am automating the provisioning ORG's from the environment hub from a Trialforce template.  The SignupRequest API method works great and gets the baseline ORG ready.  However, after the new ORG is provisioned, i need to prepare the new ORG leveraging various API requests.  (Create / Modify users, load data, execute APEX code, etc..)  

Is there any way to get the API token of the defined admin user for the new ORG, bypassing the welcome email and then going into the UI manually and resetting the token / resetting the password of the admin user?  I understand a password would need to be defined first, and i am not sure there is a way to define the password via SignUpRequest.  My goal is to avoid manual intervention.

There also seems to be an AuthCode that would return from the SignUpRequest that i can exchange for an OAuth token.  Could that be the workaround?

Thanks in advance!

Christian Dylan CarterChristian Dylan Carter
You're right, the AuthCode is the way! If you pass in the Consumer Key and Callback URL from a registered Connected App, once the instance is provisioned, you'll recieve an OAUTH 2.0 Auth Code which you can trade in for an auth token and then start making API calls against. A great use case is to create a bunch of users with SSO settings on provisioning.