<turbo-stream action="update" target="wiki_card"><template>

<h1>Connect to Salesforce with JWT Bearer authentication</h1>
<div class="trix-content"><h2>Overview</h2><p>A Salesforce connection in Rapidi can now log in with a JWT Bearer certificate instead of the browser Authorize flow. JWT issues no refresh token, so connections no longer break and need re-authorizing.</p><p>The customer does not create a certificate, a private key or a connected app. Rapidi holds the certificate on its own connected app and keeps the matching private key on the Rapidi central service. The customer only has to do two things:</p><ol><li>Pre-authorize the integration user in Salesforce.</li><li>Set two fields on the Rapidi connection.</li></ol><p>There is no browser Authorize step and no password. Username and password login on Salesforce connections is retired, so the only two options are the browser Authorize flow and JWT.<br><br><br></p><h2>Before you start</h2><p><br></p><p>Check these two conditions on the Rapidi side before you change anything in Salesforce:</p><ul><li><strong>The connection runs on the Rapidi central service.</strong> JWT only works for connections on the central service, which is the standard setup for Salesforce.</li><li><strong>The service runs dbb 4.2.01p13 or later.</strong> On older versions the Authentication Type field is not shown, and the connection can only use OAuth with a refresh token.</li></ul><p>You also need the Salesforce username of the user the integration will connect as. A dedicated integration user is recommended: every record Rapidi writes is owned by that user, and its password never has to be rotated for Rapidi's sake.<br><br></p><h2>Step 1: Authorize the user in Salesforce</h2><p><br></p><p>JWT skips the browser consent screen, so Salesforce only issues a token to a user who was approved in advance. Both parts of this step set up that approval.</p><h3>Pre-authorize the user for the Rapidi connected app</h3><ol><li>In Setup, search for <strong>Manage Connected Apps</strong>, open it and click the Rapidi app. This page lists only connected apps, so the Rapidi app is easy to find.</li><li>Choose <strong>Edit Policies</strong> and set <strong>Permitted Users</strong> to <strong>Admin approved users are pre-authorized</strong>. Save.</li><li>Back on the app's page, use <strong>Manage Profiles</strong> or <strong>Manage Permission Sets</strong> to add the integration user's profile or permission set.</li></ol><p>A user who is not on that list gets <code>invalid_grant: user hasn't approved this consumer</code>, even if everything else is correct.</p><p><strong>Note:</strong> The Permitted Users setting applies to everyone who uses the Rapidi connected app, not only the JWT user. Users who used to approve the app themselves in the browser also need a profile or permission set assigned. A dedicated permission set for Rapidi users is usually the simplest option.<br><br><br></p><h3>Allow logins from Rapidi's IP addresses</h3><p><br></p><p>JWT always enforces the <strong>Login IP Ranges</strong> on the connecting user's own profile. This applies even when the connected app's IP Relaxation is set to <strong>Relax IP restrictions</strong>, so that setting does not help here.</p><p>In Setup, open <strong>Profiles</strong>, open the integration user's profile and check <strong>Login IP Ranges</strong>:</p><ul><li><strong>The list is empty:</strong> nothing to do. Logins are allowed from any IP address.</li><li><strong>Ranges are listed:</strong> add each Rapidi outbound address below as its own range, with the same address as both Start and End.</li></ul><p><br></p><p></p><figure class="attachment attachment--content"><table class="table table-bordered"><thead><tr><td>Start IP</td><td>End IP</td></tr></thead><tbody><tr><td>52.89.22.131</td><td>52.89.22.131</td></tr><tr><td>44.231.117.185</td><td>44.231.117.185</td></tr><tr><td>18.192.113.185</td><td>18.192.113.185</td></tr><tr><td>3.127.5.0</td><td>3.127.5.0</td></tr><tr><td>3.125.195.248</td><td>3.125.195.248</td></tr><tr><td>3.70.3.151</td><td>3.70.3.151</td></tr></tbody></table><figcaption class="attachment__caption"></figcaption></figure><br>Nothing has to be uploaded. The certificate is already on the Rapidi connected app, and the private key never leaves the Rapidi service.<br><br><p></p><h2>Step 2: Switch the connection in MyRapidi</h2><p><br></p><ol><li>Open the Salesforce connection and choose <strong>Edit</strong>.</li><li>Set <strong>Authentication Type</strong> to <strong>JWT Bearer (certificate)</strong>.</li><li>Enter the integration user's Salesforce username in <strong>Salesforce Username</strong>. Use the username exactly as shown in Salesforce Setup, not the email address the user signs in with (if they differ) and not a nickname.</li><li>Choose <strong>Save</strong>.</li></ol><p>Once the connection is saved as JWT, the <strong>Authorize</strong> button disappears. This is expected: a new signed assertion is created for every token request, so there is nothing to authorize and no refresh token to expire.</p><p>If the Authentication Type field is not on the Edit screen, the service runs a dbb version older than 4.2.01p13. Reach out to support to upgrade the service first.<br><br><br></p><h2>Step 3: Verify the connection</h2><p><br></p><p>Choose <strong>Test</strong> on the connection. A pass means Salesforce accepted the signed assertion and returned an access token, which is the whole flow.</p><p>If the test fails, the message on screen usually names the cause (see Troubleshooting below).<br>&nbsp;<br>For more detail, check <strong>Login History</strong> in Salesforce: in Setup, open <strong>Users</strong>, open the integration user and scroll to the <strong>Login History</strong> list. JWT logins appear there like any other login, and the <strong>Status</strong> column often gives a more specific reason than the error shown in Rapidi.</p><p>If you still can't find the cause, contact Rapidi support.<br><br><br></p><h2>Troubleshooting</h2><p><br></p><p></p><figure class="attachment attachment--content"><table class="table table-bordered"><thead><tr><td>Error message</td><td>Cause</td><td>Fix</td></tr></thead><tbody><tr><td>invalid_grant: user hasn't approved this consumer</td><td>The user is not pre-authorized for the Rapidi connected app</td><td>Add the user's profile or a permission set under Permitted Users on the app</td></tr><tr><td>invalid_grant with no detail, and Login History shows a restricted IP failure</td><td>The user's profile has Login IP Ranges that exclude Rapidi</td><td>Add Rapidi's IP ranges to the profile, or clear the ranges</td></tr><tr><td>invalid_grant: invalid assertion</td><td>The username is wrong, or the user is no longer active in the Salesforce org</td><td>Check the username exactly as Setup shows it, and check that the user is active</td></tr><tr><td>This Salesforce Connection uses the JWT authentication type but has no UserID</td><td>Authentication Type is JWT but Salesforce Username is empty</td><td>Fill in Salesforce Username</td></tr></tbody></table><figcaption class="attachment__caption"></figcaption></figure>For any other error, contact Rapidi support.<br><br><p></p></div>
</template></turbo-stream>

