Callback handler fail 400 Bad request with NextJS

Problem statement

Navigate to login from the unauthenticated page fails


  1. The /api/auth/callback is showing a Chrome error “net::ERR_HTTP_RESPONSE_CODE_FAILURE” a few milliseconds after, so a timeout is discarded.
  2. LoginHandlerError: Login handler failed.
  3. CallbackHandlerError: Callback handler failed.
  4. 400 Bad request

Steps to reproduce

  1. Go to the unauthenticated page
  2. Login


  • HAR file
  • Debug the application to analyze step-by-step behavior (see-through objects received in each step, check differences with the Sample behavior, etc.)
  • Provide replication steps


Library was @adobe/aem-headless-client-nodejs


Replace it with@adobe/aem-headless-client-js