CRMJettyBack to crmjetty.com
Menu

Salesforce

Introduction

Hosting and deployment

Account and billing

Connect your CRM

Payments

Widgets

Admin and dashboards

Portal users

Email and notifications

Forms

Lists

Pages

Roles and permissions

Branding and navigation

Workflows

Support and knowledge base

Languages

Login and security

CRM connection and sync

Integrations and AI

More

Docs / Salesforce

Salesforce Customer Portalv6.3.0

Guides / Connect your CRM

How to Set Up Salesforce JWT Authentication for the Portal

6 min readUpdated
Short answerUse OpenSSL to generate a private key and an x509 certificate, then create a Salesforce external client app with the JWT Bearer Flow enabled and the server.crt file uploaded. Copy the Consumer Key from the Consumer Details page.

JWT authentication uses the OAuth 2.0 JWT bearer flow: the portal connects to Salesforce with a digital certificate instead of an interactive sign-in. You generate a private key and certificate, then upload the certificate to a Salesforce external client app.

Before you start

Generate the private key and certificate

  1. Create a folder named JWT.

  2. Open a command-line terminal in the JWT folder.

  3. Generate a pass key:

    openssl genrsa -des3 -passout pass:YOUR_PASSPHRASE -out server.pass.key 2048
  4. Generate the private key:

    openssl rsa -passin pass:YOUR_PASSPHRASE -in server.pass.key -out server.key
  5. Generate a certificate signing request. This command asks for details, so enter valid values when prompted:

    openssl req -new -key server.key -out server.csr
  6. Generate the x509 certificate:

    openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.crt
  7. Generate the public key:

    openssl x509 -pubkey -noout -in server.crt > pubkey.pem

The folder now contains five files:

File What it is
server.pass.key Pass-protected key used to create the private key
server.key Private key
server.csr Certificate signing request
server.crt x509 certificate, valid for 365 days. You upload this to Salesforce.
pubkey.pem Public key

Note: Replace YOUR_PASSPHRASE with a passphrase of your own and use the same one in steps 3 and 4.

Important: server.key is an unencrypted private key. Store it securely and do not share it or commit it to source control.

Important: The certificate is valid for 365 days (-days 365). Generate a new certificate and upload it to the external client app before it expires.

For more detail, see Salesforce’s guide: Create a Private Key and Self-Signed Digital Certificate.

Create the external client app with the certificate

Salesforce now creates new integrations as External Client Apps. If your org still uses connected apps, see How to Set Up a Salesforce Connected App for the Portal.

  1. In Salesforce, go to Setup.
  2. Type External Client App Manager in the Quick Find box and select it.
  3. Select New External Client App.
External Client App Manager in Salesforce Setup with the New External Client App button highlighted
  1. In the Basic Information section, enter the External Client App Name, API Name and Contact Email. Leave Distribution State as Local.
New External Client App Basic Information section with the app name, API name, contact email and distribution state
  1. In the API (Enable OAuth Settings) section, select the Enable OAuth checkbox.
  2. In Callback URL, enter https://login.salesforce.com/oauth2/callback.
  3. In OAuth Scopes, move Manage user data via APIs (api) and Perform requests at any time (refresh_token, offline_access) from Available OAuth Scopes to Selected OAuth Scopes.
API (Enable OAuth Settings) section with Enable OAuth selected, the Callback URL entered and the api and refresh_token scopes selected
  1. In Flow Enablement, select Enable JWT Bearer Flow.
  2. Under Certificate Upload, select Upload Files and upload server.crt.
  3. In Security, select Require secret for Web Server Flow and Require secret for Refresh Token Flow.
  4. Create the app.
Flow Enablement section with Enable JWT Bearer Flow selected and server.crt uploaded under Certificate Upload

Note: Salesforce locks some settings in this section, such as the PKCE and refresh token rotation checkboxes. To change a locked setting, contact Salesforce Support.

Set the app policies

  1. Open the external client app from External Client App Manager and select the Policies tab.
  2. Select Edit.
  3. Under App Policies, move the profile of the Salesforce user the portal connects as, for example System Administrator, to Selected Profiles.
Policies tab App Policies section with System Administrator profiles in Selected Profiles
  1. Expand OAuth Policies.
  2. Set Permitted Users to Admin approved users are pre-authorized.
  3. Under App Authorization, set IP Relaxation to Relax IP restrictions.
  4. Set Refresh Token Policy to suit your security rules, then select Save.
OAuth Policies section with Permitted Users, Refresh Token Policy and IP Relaxation settings

Note: Relaxing IP restrictions lets the app be used from any IP address. If your org enforces IP ranges, add your portal server’s IP addresses instead.

Tip: For tighter control, assign a dedicated integration user’s profile or a permission set instead of System Administrator.

Get the Consumer Key

  1. Open the external client app and select the Settings tab.
  2. Expand OAuth Settings and select Consumer Key and Secret.
OAuth Settings section of the Settings tab with the Consumer Key and Secret button highlighted
  1. If Salesforce asks you to verify your identity, approve the request in Salesforce Authenticator or enter the verification code it sends you.
Salesforce identity verification page asking to approve the request in Salesforce Authenticator
  1. On the Consumer Details page, copy the Consumer Key.
Consumer Details page showing the Consumer Key and Consumer Secret with Copy buttons

You need the Consumer Key, the Salesforce username the portal connects as, and the server.key private key file to set up CRM authentication in the portal admin under Settings → Portal Settings → CRM Authentication. For where to find each value, see How to Find Your Salesforce Consumer Key and Secret.

Did this solve it?No, contact support