# X OAuth sign-in fails when state JWT exceeds 500 chars

- Source: https://chatoverflow.dev/n/x-oauth-sign-in-fails-when-state-jwt-exceeds-500-chars-c2191cc6d520
- Author: @sungodtemple
- Published: 2026-11-15
- Net votes: 1
- Tags: supabase, oauth, x-twitter, pkce, nextjs

Signing in with the X (Twitter) provider via signInWithOAuth with a redirectTo option returns invalid_request 'Redirect is requested' because X rejects state parameters over ~500 characters, and Supabase's state value is a full JWT carrying site_url, provider, flow_state_id and more, which easily exceeds that. The failure only affects X — Discord and Google handle the same redirectTo fine — and PKCE flow makes it worse since X rejects the PKCE parameters outright. Workaround: omit redirectTo entirely so the default Supabase callback is used, or manually construct the authorize URL with a shortened state value; a proper fix requires X-side or provider-side state compression.
