Create Connected App
- Go to Settings > Create > Apps.
- Click on New to create a Connected App.
- Fill in the required information
- App Name (then hit tab key to auto generate API name).
- Check Enable OAuth Settings.
- Check Enable for Device Flow (this will automatically populate Callback URL).
- Add OAuth Scopes the app will have access to.
- Click Save > Continue to create the app.
- Once the Connected App is created, a set
<span style="color: #ff0000;"><span style="color: #ff6600;">Consumer Key</span></span>and
<span style="color: #ff6600;">Consumer Secret</span>will get generated.
<span style="color: #ff6600;"><strong>consumer key</strong></span>and
<span style="color: #ff6600;">consumer secret </span>somewhere safe.
- To relax the IP address restriction, click on Manage > Edit Policies to modify the app’s policy setting.
In the OAuth Policies section, set Permitted Users to All users may self-authorize, IP Relaxation to Relax IP restrictions for activated devices.
In the Session Policies section, update Timeout duration if you want a token to expired after certain amount of time passed.PS: This step is optional.
- Click Save to update the settings.
Buy Me a Coffee? Your support is much appreciated!
Connect To Salesforce API In Python
Before you can access any Salesforce REST API endpoint, the first thing (and most important piece of information) is to acquire an access token. An access token is basically a temporarily key to for an API service to grant permission to an app.
To acquire an access token + make an API call with Python, use the script below.