designsource login signs a computer in without a browser on that computer: it asks the app for a code, shows it, and polls until you approve the code in a browser where you are signed in. The shape is the device grant (RFC 8628) on the app's own routes.
How to use it
POST /api/device/codewith{ "clientName" }(up to 60 characters of letters, digits, spaces and'._-). No credential. The answer is{ "deviceCode", "userCode", "verificationUri", "expiresIn", "interval" }: an 8-character user code shown asXXXX-XXXX, the app's/devicepage, 600 seconds of life, and a 5-second polling interval.- Show the user code and open
/device. The signed-in user types it; the page shows the client name, where and when the request started, and what the token may do, thenApproveorDeny. POST /api/device/tokenwith{ "deviceCode" }everyintervalseconds. Until approved,400 { "error": "authorization_pending" }; once approved,200 { "accessToken", "scopes", "account": { "email" } }, once only.
The /device page itself calls POST /api/device/lookup with { "userCode" } to show the request and POST /api/device/approve with { "userCode", "decision": "approve" | "deny" } to settle it. Both are same-origin only and for the signed-in browser.
How it works
The device code is 32 random bytes; the user code is 8 characters from an alphabet without look-alikes. Both are stored as hashes. Starting a code is anonymous and throttled to 10 an hour per address; looking a code up or approving it spends an attempt per account and per address (5, then a wait that doubles), and a correct code gives the attempt back, so a right code cannot reset a wrong-code count.
Lookup and approve refuse an unverified email address (403 email_unverified) before any attempt is spent, since the approval email is the owner's warning. Approving records the session's version on the request; the token is minted only while that version still matches, in one transaction with marking the code used, so two polls mint one token and a password change between approving and polling mints none.
The token lands in the computer's private store, never in a file the agent reads. It holds projects:read, projects:create and screens:create, lives 90 days from its last use, and ends on designsource logout, from the profile's Coding apps card, on a password change, a sign-in unlink or account deletion. The account is emailed when a device is approved.
The Figma plugin asks for a code the same way, with scopes: ["figma:import"] in the first call. That scope opens exactly three routes and nothing else: GET /api/agent/projects (the project list the plugin's picker shows), POST /api/figma/imports (the plugin posts what it read from the file, or the frames picked for screens) and PUT /api/figma/imports/<id>/frames/<n> (one picture per frame, raw image/jpeg up to 600,000 bytes and 1568 pixels on a side). Frames are posted first as a list with their outlines; the answer lists the frame numbers still waiting for a picture (uploads), and each picture goes to the import's address for that frame number, so a picture never rides the JSON body. Pictures are cleared after seven days; a frame set can be used for seven days.
What can go wrong
authorization_pending: not yet approved.slow_down: polled too fast; add five seconds.access_denied: denied in the browser.expired_token: ten minutes passed, the code was used, or the account changed its password since approving.404on lookup or approve: unknown, expired or used code; one answer for all three.403 email_unverified: verify the address first.403 Cross-site request refused: the page must be the app's own.429 rate_limited: too many starts, or too many wrong codes.
Related
loginandlogout: the client side.- Agent routes: what the token opens.
- Error codes.