STUDIO Visual Editor
-
If you haven’t already done so, create a new Mule project, then access the Global Elements tab at the bottom of the canvas.
-
Click Create, then expand the Connector Configurations node and select the appropriate global type that matches your OAuth-enabled connector. Click OK.
-
In the Global Element Properties panel, enter the Consumer Key and Consumer Secret with the information that the software service provider gave you.
-
On the OAuth tab, enter the callback URL’s Domain , Port, and Path . The example below results in a callback URL of
http://localhost:8081/callback
.Field Example Value Example CloudHub Value Description Domain
localhost
${fullDomain}
Should be the domain assigned to the listener at the start of your OAuth callback flow. When in production, this is the domain on which your application is hosted.
Local Port
8081
${http.port}
The port on which your authorization flow is hosted. This is the port configured on your HTTP Inbound Endpoint.
Remote Port
${fullDomain}
The port of the listener at which your OAuth callback is hosted.
Path
callback
callback
The path of the listener at which your OAuth callback is hosted.
Default Access Token Id
n/a
n/a
Not used in this example. Read more about Managing OAuth Tokens.
Controlling Flow Processing
You can configure your connector to define the behavior of a connector when a user with no OAuth token attempts to utilize the service (i.e. the user is not yet authenticated via OAuth). Use the On No Token field to select one of the following two options.
STOP_FLOW |
Behaving like a filter, this option kills flow execution . This choice is ideal for keeping log files light as it doesn’t create exceptions before you have had a chance to authorize your connector to access the OAuth provider. |
EXCEPTION |
(Default) Throws an exception advising the user that an OAuth token is required |
XML Editor or Standalone
-
Configure a global Salesforce (OAuth) element according to the table below.
<sfdc:config-with-oauth name="salesforce" consumerKey="[insert key]" consumerSecret="[insert secret]" doc:name="Salesforce (OAuth)"> </sfdc:config-with-oauth>
Global Element sfdc:config-with-oauth
Attribute Value name
name of the global element
consumerKey
consumer key as provided by service provider
consumerSecret
consumer secret as provided by service provider
doc:name
Studio only. Name of the global element.
-
Add a child element to define the Callback URL. The example below results in a callback URL of http://localhost:8081/callback.
<sfdc:config-with-oauth name="salesforce" consumerKey="[insert key]" consumerSecret="[insert secret]" doc:name="Salesforce (OAuth)"> <sfdc:oauth-callback-config domain="localhost" remotePort="8081" path="callback"/> </sfdc:config-with-oauth>
Attribute Example Value Example CloudHub Value Description domain
localhost
${fullDomain}
The domain of the listener on your OAuth callback flow. When in production, this is the domain on which your application is hosted.
localPort
8081
${http.port}
The port you configured on the listener of the authorization flow
remotePort
${fullDomain}
The port you configured on the listener of the OAuth callback.
path
callback
callback
The path of the listener at which your OAuth callback is hosted.
defaultAccessTokenId
n/a
n/a
Not used in this example. Read more about Managing OAuth Tokens.
Controlling Flow Processing
You can configure your connector to define the behavior of a connector when a user with no OAuth token attempts to utilize the service (i.e. the user is not yet authenticated via OAuth). Use the onNoToken attribute to define one of the following two options.
STOP_FLOW |
Behaving like a filter, this option kills flow execution. This choice is ideal for keeping log files light as it doesn’t create exceptions before you have had a chance to authorize your connector to access the OAuth provider. |
EXCEPTION |
(Default) Throws an exception advising the user that an OAuth token is required |
<sfdc:config-with-oauth name="salesforce" consumerKey="[insert key]" consumerSecret="[insert secret]" doc:name="Salesforce (OAuth)" onNoToken="[STOP_FLOW]">
<sfdc:oauth-callback-config domain="localhost" remotePort="8081" path="callback"/>
</sfdc:config-with-oauth>