Skip to content

API key not working, headless returns 404 & OAuth token returns 401 "invalid_client" #2056

@jeremynwa

Description

@jeremynwa

Describe the bug

WebContainer API key (Personal plan, 25k sessions/month) does not work — both configureAPIKey() and auth.init() fail. The headless endpoint returns 404 and the OAuth token endpoint returns 401 "invalid_client", despite the key being enabled and the domain whitelisted in the API Console. API Console shows 0 sessions recorded.

Link to the blitz that caused the error

https://purple-bay-0c1aa211e.4.azurestaticapps.net

Steps to reproduce

  1. Create API key in API Console (Keys & Domains), enable it
  2. Add production domain to Allowed Sites
  3. In frontend code: configureAPIKey('wc_api_***') then WebContainer.boot({ coep: 'credentialless' })
  4. Deploy to HTTPS host with headers Cross-Origin-Embedder-Policy: credentialless and Cross-Origin-Opener-Policy: same-origin
  5. Browser console shows crossOriginIsolated: true and SharedArrayBuffer: available
  6. Iframe request to stackblitz.com/headless?client_id=wc_api_***&coep=credentialless&version=1.6.1 returns 404
  7. Also tried auth.init({ clientId, scope: '' }) — /oauth/authorize works (shows permission dialog), but POST /oauth/token returns 401 with error="invalid_client"
  8. API Console Usage shows 0 sessions
  9. Directly visiting the headless URL in browser also returns 404
  10. localhost works fine without API key (as expected)

Expected behavior

The headless endpoint should return 200 and serve the WebContainer runtime when a valid client_id is provided from a whitelisted domain. The OAuth token exchange (POST /oauth/token) should succeed after user authorization. API Console Usage should record sessions.

Parity with Local

Screenshots

Image

Platform

  • OS: Windows 10
  • Browser: Chrome
  • Version: 144

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions