shadcn.io is not affiliated with official shadcn/ui
Invalid Token Error Block for React
A full-screen invalid-token page for an identity API: three ruled checks (Format failed with the parts drawn, Signature and Expiry not checked), a masked fingerprint to copy, Sign in again, and a Report to security list of exactly what a report would attach.
Installation
Overview
Tell people what failed without ever showing the token, with this invalid token error page for React with Base UI. It's the hosted error screen of Keywright, an identity API: a whole screen with the page's rails and one band across it, its content a start-aligned column. Under the heading, three checks stand in rows ruled by Guides: Format failed, with "3 parts expected, 2 found" drawn as two parts present (header and payload, with their lengths, never their content) and one dashed and missing; Signature and Expiry not checked, because the first check failed. Below them, a masked fingerprint of the token with a Copy Button. A Shine Button Sign in again is the way forward, and Report to security opens a Collapsible with the list of exactly what a report would attach: the request id, the time, a partly hidden address and the fingerprint, plus the visitor's email only while a Switch says so. Send report records it in the page's state. It's built from Collapsible, Switch, Copy Button, Button, Shine Button and Guides, with a CSS entrance only. For any service that signs people in with tokens.
FAQ
Why does the page never show the token?
Because a token is a credential: anyone who sees it can use it until it expires. The page shows the shape of what was found (the names and lengths of the parts) and a fingerprint, which is a hash of the token that can be shared safely. The Copy button writes the whole fingerprint to the clipboard, never the token, and the report list says "Never the token".
What does Send report do, and what stays in the page?
It records the report in the page's state and says "Report with 4 items recorded in this demo. Nothing was sent." (5 when the email is included). Undo takes it back. Changing the Switch after sending resets the report, because it is a different report. To wire it for real, post exactly the items that are listed to your security inbox where the code says so; the list is derived from the typed ATTACHMENTS, so what the visitor reads is what you send.
Why are Signature and Expiry 'not checked'?
Because a validator stops at the first check that fails: a token that isn't in three parts has no signature to verify and no claims to read. Showing the later checks as not run is true to that, and it keeps the page from guessing. If your validator runs every check, change each row's state and detail to the real results.
Why does the page start at the top instead of the middle?
Because the report makes it taller. Most pages in this set are centred in the screen, but a centred page would move its headline when the report opened or closed; starting at the top keeps everything above the disclosure where it was.
Related
- Pro
401 Unauthorized Error
Sign-in and identityA full-screen 401 page for a reporting workspace: the heading, where the visitor was going, Sign in, and a framed list of other ways in where Single sign-on and Email me a link turn their own row into an email field in place.
- Pro
Session Expired Error
Sign-in and identityA full-screen session-ended page for a billing back office: a session ruler from 09:00 to 10:30 UTC with the active time solid and the idle gap hatched, a legend of when you signed in, were last active and were signed out, and a demo control that swaps the cause.
- 43Pro
403 Forbidden Error
Locked and removedA full-screen 403 page for a team wiki: a door drawn as the zero of 403, the heading 'Ask someone who can say yes', the three workspace admins in a framed list with a Copy email button each, and a way back to the wiki.
- Pro
IP Address Blocked Error
Blocked and limitedA full-screen blocked-address page for a bot-protection layer: a review request form (organisation and reason) beside the evidence: the address with Copy, a five-part bar for 5 of 5 failed sign-ins in 10 minutes, the five attempts and when the block lifts.
- Pro
Two-Factor Required Error
Sign-in and identityA full-screen gate for a workspace that now requires two-factor authentication: a grace period drawn as fourteen day segments, three method cells, a Set up now button and a list of steps that follows the chosen method.
- Pro
Captcha Failed Error
Sign-in and identityA full-screen page for a human check that timed out: a box to tick that escalates to a typed question, with no picture to read, over four accordion rows that show what the check looked at and what to do.