Skip to content

Conversation

cristiand391
Copy link
Member

@cristiand391 cristiand391 commented Oct 21, 2025

What does this PR do?

Adds a (non-configurable) 2 minutes timeout to the OAuth server.

WebServer starts the timer when starting the server via await WebServer.start(), also exposes a setTimeoutCallback method for WebOAuthServer to set a callback to clean up server-dependent code like WebOAuthServer.authorizeAndSave.

There's a native setTimeout method for when the socket is active:
https://nodejs.org/api/http.html#serversettimeoutmsecs-callback

It doesn't work for us because that requires a request to hit the server (and fail), so instead we use setTimeout while starting the server.

Before

OAuth server hangs indefinitely until a successful auth happens (or other req fails)

After

Server times out after 2 minutes.

Testing instructions:

  1. checkout this branch and yarn compile
  2. yarn link it into plugin-auth
  3. link the plugin and run time sf org login web, see it time out:

NOTE: in this screenshot I modified the timeout to 10s for testing, you should see a 2 min timeout:
Screenshot 2025-10-21 at 09 40 38

What issues does this PR fix or reference?

@W-19549750@

@cristiand391 cristiand391 requested a review from a team as a code owner October 21, 2025 12:42
@mdonnalley
Copy link
Contributor

QA:

🟢 sf org login web timeouts after 5 minutes

mdonnalley
mdonnalley previously approved these changes Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants