Connecting to SalesforceChatter
Salesforce Chatter uses OAuth 2.0 authentication. OAuth requires the authenticating user to interact with Salesforce Chatter using the browser. The provider facilitates this in various ways as described below.
Create a Connected App
You can follow the procedure below to register an app and obtain the OAuth client credentials, the OAuthClientId and OAuthClientSecret:
- Log into Salesforce.com.
- From Setup, enter Apps in the Quick Find box and then click the link to create an app. In the Connected Apps section of the resulting page, click New.
- Enter a name to be displayed to users when they log in to grant permissions to your app, along with a contact email address.
- Click Enable OAuth Settings and set the Callback URL to https://localhost:33333 or a different port number of your choice.
- Select the scope of permissions that your app will request from the user, including Chatter.
- Once you have created the app, click your app name to open a page with information about your app. The OAuth client credentials, the consumer key and consumer secret, are displayed.
Authenticate to Salesforce Chatter
After setting the following properties, you are ready to connect:
- InitiateOAuth: Set this to GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken.
- OAuthClientId: Set this to the Consumer Key in your app settings.
- OAuthClientSecret: Set this to the Consumer Secret in your app settings.
- CallbackURL: Set this to the Callback URL in your app settings, https://localhost:33333.
- Extracts the access token from the callback URL and authenticates requests.
- Refreshes the access token when it expires.
- Saves OAuth values in OAuthSettingsLocation to be persisted across connections.