Skip to content

Secure token request helper swallows API errors and hides auth/cookie failures #1141

@Shreyas2004wagh

Description

@Shreyas2004wagh

Summary

tokenRequestHandler logs errors but does not rethrow them, causing failed secure token requests to silently resolve as undefined.

Affected Code

  • packages/auth/src/utils/tokenRequestHandler.ts:25
  • packages/auth/src/utils/tokenRequestHandler.ts:26

Problem

In the catch block, errors are only logged:

  • no rethrow
  • no explicit failure result

This makes callers treat real request failures as missing token/null-like outcomes.

Impact

  • Silent auth/cookie failures
  • Hard-to-debug secure login behavior
  • Error handling paths are bypassed because promise rejection never occurs

Reproduction

  1. Use secure auth mode.
  2. Cause /auth-token request to fail (network failure / non-2xx).
  3. Observe tokenRequestHandler returns undefined instead of rejecting.
  4. Caller falls back as if no token was present.

Expected

Request failure should reject so callers can handle true error conditions.

Actual

Failure is swallowed and converted into implicit undefined.

Proposed Fix

Rethrow after logging in tokenRequestHandler (or return a typed error result), so callers can reliably distinguish failure from missing token cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions