Skip to main content
Andrei Asandei ha fatto una domanda in #MuleSoft

Hi,

 

I am building a Mule application where I need to connect to two distinct Salesforce sandboxes. To achieve this, I am using two Salesforce Configs, both having OAuth v2.0 connection type. I entered all necessary information (Consumer key, Consumer secret, Authorization url, Access token url, Listener config, Callback path, Authorize path, External callback url) for both configurations. 

 

Everything works fine on my local machine, because I specify different ports for each of the HTTP Listener Configs of each Salesforce Config. Therefore, when I perform the OAuth2 dance for the first Salesforce config, I navigate to https://localhost:8082/authorize in my web browser, and when I perform it for the second Salesforce config, I navigate to https://localhost:8083/authorize.

 

However, I can't figure out how to set things up for this to work when I deploy the Mule app to Cloudhub. I performed the steps from https://docs.mulesoft.com/connectors/introduction/intro-config-oauth2-cloudhub, which meant I changed the External callback url to ${fullDomain}/callback, which in turn means that, in order to perform the OAuth2 dance for the app deployed to Cloudhub, I would have to open https://{ch-app-name}.{region}.cloudhub.io/authorize (replacing {ch-app-name} and {region} with the proper values). However, the authorize URL is now the same for both Salesforce configurations, meaning I can only perform the OAuth dance for the first configuration and not the second.

 

I tried all sorts of things (trying to use different ports and different Authorize paths between the 2 Salesforce configs), but nothing seems to work.

 

Can you please advise what I need to do in order to have two functional Salesforce configurations (OAuth2) inside the same Mule app deployed to Cloudhub?

 

Thank you!

3 risposte
  1. 17 ott 2024, 09:42

    In case anyone else needs an answer to this, the issue was that I was using port 8083 on Cloudhub. That's why it wasn't working.

     

    After using the same HTTP listener config (that uses port 8082) for both Salesforce OAuth2 configs, I was able to use different Callback and Authorize paths and External callback urls between the 2 Salesforce OAuth2 configs and that allowed me to distinguish between the two and perform the OAuth2 dance separately for each one.

0/9000