Menu

Salesforce MCP - the hidden gotcha of incorrectly issued Access Token
📰

Salesforce MCP - the hidden gotcha of incorrectly issued Access Token

DEV Community: authentication·DarkEdges·4 days ago
#jrIYJpU7
Long article (610 words) — no AI summary yet.
Reading 0:00
15s threshold

Fixing token_expired When Connecting MCP Inspector to Salesforce Hosted MCP Servers

If you are testing Salesforce Hosted MCP Servers locally using @modelcontextprotocol/inspector , you will likely hit two frustrating roadblocks before seeing a single tool schema:

Salesforce rejects plain http://127.0.0.1 callback URLs.

Once you get HTTPS working and complete OAuth, MCP Inspector immediately fails with Auth challenge: token_expired and Unexpected: auth() returned AUTHORIZED without authorization code - even though your network tab shows tokens arriving cleanly.

Here is the exact local HTTPS setup and the one Salesforce OAuth checkbox that fixes the handshake loop.

Step 1: Serve MCP Inspector over Local HTTPS with mkcert

Salesforce strictly enforces HTTPS on external callback URLs (only exempting http://localhost in narrow contexts, while rejecting [http://127.0.0.1](http://127.0.0.1) , which MCP Inspector binds to by default).

Use mkcert to generate a locally trusted certificate for 127.0.0.1 and pass…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.