AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Docs: OAuth 2.1 Server Consent Example Uses Wrong Response Property (`Redirect_to` Vs `Redirect_url`)

The Supabase OAuth 2.1 Server getting started guide contains consent page examples that incorrectly use `data.redirect_to` from `supabase.auth.oauth.approveAuthorization()` / `denyAuthorization()`. The SDK actually returns `data.redirect_url`, and also auto-redirects by default. Following the docs leads to `window.location.href = undefined`, causing an infinite redirect loop.

mediumConfidence 95%Supabasepgvectorsupabase-js

Origin Analysis

The documentation code snippets mistakenly reference `data.redirect_to`, which does not exist on the response object. In the Supabase JS SDK (GoTrueClient.ts), the property is named `redirect_url`. Additionally, the SDK already performs an automatic redirect to `response.data.redirect_url` in browser environments unless `skipBrowserRedirect: true` is passed, making the manual `window.location.href` assignment redundant and harmful when the property is undefined.
1. Follow the 'Getting Started with OAuth 2.1 Server' guide. 2. Implement the consent page code as shown, using `data.redirect_to`. 3. Approve or deny the authorization. 4. The browser executes `window.location.href = undefined`, which resolves to a relative URL (e.g., `/oauth/undefined`). 5. The page reloads and may re-trigger the consent flow, creating an infinite loop.

Fixing Code Block

// Approve authorization const { data, error } = await supabase.auth.oauth.approveAuthorization(authorizationId) if (error) throw error // The Supabase JS SDK automatically redirects to data.redirect_url in browsers. // No manual window.location assignment is needed unless skipBrowserRedirect: true is passed. // Deny authorization const { data, error } = await supabase.auth.oauth.denyAuthorization(authorizationId) if (error) throw error // SDK auto-redirects as well.
Replace all references to `data.redirect_to` with `data.redirect_url`, or better, remove the manual `window.location` calls entirely and rely on the SDK's built-in redirect behavior. This eliminates the undefined assignment and prevents the redirect loop. The fix is purely in documentation; no SDK code changes are required.

Edge Case Audit

Updating only the documentation has no runtime risk. However, developers who have already implemented a manual redirect using `data.redirect_to` must update their code to `data.redirect_url` or remove the manual redirect. If they use `skipBrowserRedirect: true`, they must manually redirect using `data.redirect_url`; otherwise the user will not be redirected. Rolling back the docs to the previous version will reintroduce the bug.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state