Redirect URI Input

Redirect URI Input is a copy-paste React component that stops oauth redirect_uri_mismatch error before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/redirect-uri-input
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsOAuth redirect_uri_mismatch error

Was this component page useful?

How do I install Redirect URI Input?

pnpm dlx shadcn@latest add @bollard/redirect-uri-input

The files land in your project. They're yours to edit.

How do I use Redirect URI Input in React?

redirect-uri-input-usage.tsx
import { RedirectUriInput } from "@/components/ui/redirect-uri-input"

<RedirectUriInput value={uri} onValueChange={setUri} registered={registered} production />

What input mistakes does Redirect URI Input catch?

  • Near-misses against registered URIs: trailing slash, http vs https, case, www, port
  • Side-by-side highlight of the differing characters, with a one-tap swap
  • localhost or loopback in a production client
  • Wildcards, a #fragment, default :443 port, empty ? and stray whitespace
  • Short custom schemes for native apps

What props does Redirect URI Input accept?

RedirectUriInput props
PropTypeDefault
value

Controlled URI.

string—
defaultValue

Initial URI when uncontrolled.

string""
onValueChange

Called on every change and fix.

(value: string) => void—
registered

URIs registered with the provider. Turns on the exact-match check with a near-miss diff.

string[][]
production

A production client: localhost is an error. Plain http to any other host is always an error (RFC 9700 §2.6).

booleanfalse
native

A native or desktop app (RFC 8252): loopback ports may vary and custom schemes are expected.

booleanfalse
onIssuesChange

Called with the current issues after each check, so a form can block saving on errors.

(issues: RedirectIssue[]) => void—
delay

Pause in ms before the check runs while typing. Leaving the field or a fix runs it at once.

number500
messages

Override any visible or announced text.

Partial<RedirectUriMessages>—

* required. Also accepts the native props of <input> (className, aria-*, data-*…), passed through to it.

How is Redirect URI Input accessible?

  • Visible <label> tied to the input; aria-invalid on errors
  • Status summary in a polite live region linked by aria-describedby
  • After a one-tap fix, focus returns to the input
  • Match state shown with icon and text

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

This is a UX guard rail. Enforce on the server: The authorization server must compare redirect_uri by exact string match against the registered list.

  • Checks the string only; it cannot see what your provider actually has registered unless you pass it
  • Providers differ (some allow loopback port variation for native apps); follow your provider's rules
  • Not a substitute for server-side exact matching

What validation rules apply to Redirect URI Input?

Rules last verified:

Confirmed: RFC 9700 requires exact string matching of redirect URIs, except variable port numbers for localhost redirect URIs of native apps. Copied components don't update themselves, so re-check after rule changes (see updating a component).

What expensive mistakes does Redirect URI Input stop?

OAuth redirect_uri_mismatch error

Also known as

oauth · redirect uri · callback url · google sign in · nextauth · auth0 · openid · sso

Field type

What dependencies does Redirect URI Input require?

Redirect URI Input facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameRedirect URI Input
Registry identifier@bollard/redirect-uri-input
Install commandnpx shadcn@latest add @bollard/redirect-uri-input
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Redirect URI Input

What form validation mistake does Redirect URI Input catch?

Redirect URI Input prevents oAuth redirect_uri_mismatch error. Catches OAuth redirect URIs that are close to but not exactly the registered one, plus unsafe ones like localhost in production or wildcards. Catches: Near-misses against registered URIs: trailing slash, http vs https, case, www, port, Side-by-side highlight of the differing characters, with a one-tap swap, localhost or loopback in a production client, Wildcards, a #fragment, default :443 port, empty ? and stray whitespace, Short custom schemes for native apps. Limitation: validate redirect-uri-input schemas on backend.

How do I install redirect-uri-input with shadcn?

Run `npx shadcn@latest add @bollard/redirect-uri-input`. Sources added: registry/default/redirect-uri-input/redirect-uri-check.ts, registry/default/redirect-uri-input/redirect-uri-input.tsx. Package requirements: lucide-react.

What props customize Redirect URI Input?

Redirect URI Input accepts `value`, `defaultValue`, `onValueChange`, `registered`, `production`. Configures oauth, redirect uri, callback url behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of redirect-uri-input?

Checks the string only; it cannot see what your provider actually has registered unless you pass it. Providers differ (some allow loopback port variation for native apps); follow your provider's rules. Not a substitute for server-side exact matching Server requirement: The authorization server must compare redirect_uri by exact string match against the registered list.

How does Redirect URI Input meet accessibility guidelines?

Visible <label> tied to the input; aria-invalid on errors. Status summary in a polite live region linked by aria-describedby. After a one-tap fix, focus returns to the input. Match state shown with icon and text. Minimizes errors: redirect_uri_mismatch, oauth callback url wrong.

Which components pair with Redirect URI Input?