2

I am trying to dynamically update the callback url in a connected app.

When creating a sandbox, I want to run an apex class that change the callback URL from a production to UAT callback endpoint.

I am assuming that I would place this in the implements SandboxPostCopy apex class where I am updating other custom settings to point to lower environments when the sandbox is done copying.

Is there anyway to have the Callback URL in a connected app be dynamic by referencing a custom setting with {!$Setup.myCustomerSetting__c.activeCallBackUrl__c}? Is there any other way to do this dynamically?

1 Answer 1

3

Your options:

  1. Update the callback URL via Metadata API called from your post-refresh script that implements SandboxPostCopy (example)

  2. Have the callback URL point to your VF page, then do the redirect to the actual callback endpoint from there. You can then use standard platform services for managing config values.

  3. Don't clone the connected app. In oAuth, the Authorization Server and the Resource Server are separate entities. The Authorization Server is the SF org hosting a connected app, it will be responsible for authorizing your client. Resource Server is the org that hosts the API callable by your client. You can host a connected app in a single org acting as the Authorization Server...and still be able to acquire access token and call APIs in all other orgs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.