Extension API Details Objects, Permissions, and Authentication
How Chrome extension APIs use details objects, host permission UI, certificate PIN flows, and WebAuthn proxy requests.
This page summarizes Chrome extension API reference material from Chrome for Developers, centered on the promise-based browser.* namespace and closely related chrome.* surfaces. The cluster covers how many methods pass structured details (or request) objects, how permission prompts are scoped to tabs or URL patterns, and how several security-sensitive APIs chain request IDs, allow/deny handlers, and user input back to the extension.
browser.* and chrome.*: which API surface to use
Section titled “browser.* and chrome.*: which API surface to use”Extension code can call either the browser namespace (WebExtensions-style, promise-based) or the chrome namespace (Chrome-specific, often callback-based). Several reference pages note minimum Chrome versions for browser.* entry points—for example, browser.devtools.inspectedWindow documents getContent and setContent as available with Chrome 151+ browser.* since Chrome 152, and browser.identity lists Chrome 84+ browser.* since Chrome 148 for profile-related details.
| Surface | Typical call style | Where this cluster shows it |
|---|---|---|
browser.* |
Promises, details objects |
browser.permissions, browser.certificateProvider, browser.webAuthenticationProxy |
chrome.* (MV2 reference) |
Callbacks, same shapes in places | chrome.certificateProvider, chrome.desktopCapture |
Embedded UI (chrome.webviewTag) |
DOM events + allow() / deny() on request objects |
chrome.webviewTag |
For new extension work, start from the MV3 browser.* reference and mirror any legacy chrome.* page only when you still ship MV2 or Chrome Apps–era code.
When do people look this up?
Section titled “When do people look this up?”Developers usually hit these pages when TypeScript types or runtime errors mention a missing field on details, when a permission banner appears on the wrong tab, when a corporate PIN dialog must be wired to certificateProvider, or when passkey flows need the extension to answer webAuthenticationProxy events.
The details parameter: shared pattern across APIs
Section titled “The details parameter: shared pattern across APIs”A large share of methods in this cluster take a single object argument named details (or request for rule testing). That object carries tab/frame context, tokens, certificates, or dialog configuration instead of many positional parameters.
Examples from the reference:
browser.action—details:TabDetailsbrowser.cookies—details:FrameDetailsbrowser.declarativeNetRequest—request:TestMatchRequestDetails(same idea: one structured payload to test a rule)browser.identity— optionalTokenDetails,ProfileDetails,WebAuthFlowDetails, orInvalidTokenDetailsdepending on the methodbrowser.certificateProvider—SetCertificatesDetails,RequestPinDetails,StopPinRequestDetails,ReportSignatureDetailsbrowser.platformKeys—SelectDetails,VerificationDetailsbrowser.webAuthenticationProxy—CreateResponseDetails,GetResponseDetails,IsUvpaaResponseDetails
browser.fontSettings notes that its optional details object is currently unused—worth remembering so you do not invent fields that the platform ignores.
Practical rule: match the exact typedef name from the method you call; partial objects are only valid where the docs say Partial* (for example workbox-core uses PartialCacheNameDetails for cache naming, which is separate from extension permissions but follows the same “one details bag” pattern).
Host permissions: where the prompt appears (browser.permissions)
Section titled “Host permissions: where the prompt appears (browser.permissions)”Host access prompts can be tied to a tab, a top-level document, or a URL pattern, so the user sees the request in the right place and it is cleared on navigation.
From browser.permissions, the request object supports:
| Field | Role |
|---|---|
tabId |
Show the request on that tab; removed when the tab navigates to a new origin. Overrides an existing request for documentId. Either tabId or documentId is required. |
documentId |
Show on the tab of that document; must be the top-level document in the tab. Same navigation cleanup. Overrides requests for tabId. |
pattern |
If set, host access requests are shown only on URLs matching this pattern. |
Adding a new request will override any existent request for tabId. This or tabId must be specified.
— Google, browser.permissions
Common mistakes: passing a subframe documentId, omitting both tabId and documentId, or expecting multiple stacked prompts on one tab—the latest request wins.
browser.certificateProvider: certificates, PIN dialogs, and attempt limits
Section titled “browser.certificateProvider: certificates, PIN dialogs, and attempt limits”Enterprise and smart-card flows use browser.certificateProvider (and the MV2 twin chrome.certificateProvider) to supply certificates and handle signing PIN UI.
Setting certificates and reporting signatures
Section titled “Setting certificates and reporting signatures”setCertificatestakesSetCertificatesDetails; invalid certificates are ignored.reportSignaturetakesReportSignatureDetails.- Incoming work includes
certificatesRequestId(pass tosetCertificates) andsignRequestId(fromSignRequest).
PIN request flow and stopPinRequest
Section titled “PIN request flow and stopPinRequest”When Chrome asks the extension to show a PIN (or similar) dialog, RequestPinDetails describes the UI. Related fields on pin events include:
| Property | Meaning |
|---|---|
userInput |
Code from the user; empty if the user closed the dialog or another error occurred. |
attemptsLeft |
For UI only; Chrome does not enforce the limit—the extension must call stopPinRequest with errorType = MAX_ATTEMPTS_EXCEEDED when appropriate. |
errorType |
Template shown after a failed request or when stopping the flow (e.g. MAX_ATTEMPTS_EXCEEDED). |
requestType |
Type of code requested; default PIN. |
signRequestId |
ID from SignRequest. |
Chrome is not expected to enforce this, instead stopPinRequest should be called by the extension with errorType = MAX_ATTEMPTS_EXCEEDED when the number of pin requests is exceeded.
— Google, browser.certificateProvider
StopPinRequestDetails carries the reason for ending the flow; set errorType when stopping due to an error so the user sees an explanation.
browser.webAuthenticationProxy: passkeys and JSON-serialized WebAuthn
Section titled “browser.webAuthenticationProxy: passkeys and JSON-serialized WebAuthn”browser.webAuthenticationProxy lets an extension satisfy navigator.credentials.create() / get() on behalf of another context by exchanging JSON payloads and opaque requestId values.
Creation side:
requestDetailsJson—PublicKeyCredentialCreationOptionsas JSON, compatible withPublicKeyCredential.parseCreationOptionsFromJSON().- Responses use
CreateResponseDetails; success may includeresponseJsonfromPublicKeyCredential.toJSON(). - Errors can carry
DOMExceptionDetails.
Assertion side mirrors this with PublicKeyCredentialRequestOptions in requestDetailsJson and GetResponseDetails. IsUvpaaResponseDetails answers UV/PAA-style capability queries tied to a requestId.
Always correlate responses with the requestId from the incoming create/get request; mixing IDs across parallel operations breaks the proxy contract.
Offscreen documents: justification, reasons, and url
Section titled “Offscreen documents: justification, reasons, and url”browser.offscreen creates a hidden document when the background context needs DOM APIs. Creation details include:
| Property | Purpose |
|---|---|
justification |
Developer string explaining why the background needs this context; the user agent may show it. |
reasons |
Array of Reason values declaring why the offscreen doc exists. |
url |
Relative URL loaded in the document. |
Offscreen pages are for capabilities you cannot hold in a service worker alone (playback, clipboard, some DOM work)—not a general substitute for a visible extension page.
DevTools: reading and editing inspected resources
Section titled “DevTools: reading and editing inspected resources”On browser.devtools.inspectedWindow, resource entries expose url and:
getContent()— returns aPromise<object>when content is available (Chrome 151+ /browser.*since 152).setContent(content, commit)—contentis the new text;commitistruewhen editing is finished and content should persist,falsefor in-progress edits. Only text resources are supported today.
Use commit: false while the user types; a final commit: true avoids partial writes being treated as saves.
Desktop capture: request and cancel IDs
Section titled “Desktop capture: request and cancel IDs”browser.desktopCapture and chrome.desktopCapture share the same ID pattern:
chooseDesktopMedia()yields adesktopMediaRequestIdused when starting capture.- The API can return an id passed to
cancelChooseDesktopMedia()if the picker must be dismissed programmatically.
Losing track of that cancel id leaves the media chooser open until the user closes it.
Input method editor: onKeyEvent and sendKeyEvents
Section titled “Input method editor: onKeyEvent and sendKeyEvents”browser.input.ime (and chrome.input.ime) describe keyboard events with physical code, logical key, modifiers, and type (keydown / keyup). Reply with:
requestId— fromkeyEvent.requestId(not the deprecated property on the event object).response—trueif the extension handled the keystroke,falseif not.
keyCode is documented as deprecated HTML keyCode; prefer code / key for new IME logic.
Embedded webview: permissionrequest handlers
Section titled “Embedded webview: permissionrequest handlers”chrome.webviewTag (guest content inside an app-style embedder) surfaces many permission types—download, filesystem, fullscreen, geolocation, HID, media, pointer lock, plugins, and more. Request objects typically expose context (url, origin, requestMethod, etc.) and:
allow()— grant the capability (default for some types, e.g. load-plugin, unless youdeny()).deny()— reject; for several types this is the default if you never callallow().
Dialog helpers on the tag include ok(response?) and cancel() for guest alert / confirm / prompt. New-window requests can attach(webview) or discard().
Legacy Chrome Apps embedding (chrome.app.runtime / appview)
Section titled “Legacy Chrome Apps embedding (chrome.app.runtime / appview)”chrome.app.runtime and chrome.appviewTag cover <appview> embedding: optional data, embedderId, and allow(url) / deny() for embedding decisions. Chrome Apps are deprecated; keep this only when maintaining legacy embedders.
Common mistakes
Section titled “Common mistakes”- Treating
attemptsLefton certificate PIN UI as enforced by the browser instead of callingstopPinRequestwithMAX_ATTEMPTS_EXCEEDED. - Calling
browser.permissionsrequestwithouttabIdordocumentId, or with a non–top-leveldocumentId. - Sending
setContentwithcommit: trueon every keystroke for DevTools overrides. - Answering
webAuthenticationProxywith the wrongrequestIdunder concurrent passkey operations. - Assuming
browser.fontSettingsdetailsdoes something—it is explicitly unused. - For
webviewguests, forgetting thatdeny()is the default for several permission events whenallow()is never invoked.
How to check this on your site
Section titled “How to check this on your site”- Open
chrome://extensions, enable Developer mode, and load your unpacked extension; confirm the manifest declares every API you call (permissions,certificateProvider,offscreen, etc.) per the matching reference page (start frombrowser.actionand follow links to each API you use). - In the service worker or background page console, log the full
details/requestobject you pass into API methods and verify field names against the typedef on Chrome for Developers (for examplebrowser.declarativeNetRequestforTestMatchRequestDetails). - Trigger a host permission request with an explicit
tabIdor top-leveldocumentIdandpatternas documented onbrowser.permissions; navigate the tab to another origin and confirm the prompt is removed. - For certificate or WebAuthn flows, run through PIN and passkey paths once with the extension’s service worker logging
requestId/signRequestIdpairing; compare behavior withbrowser.certificateProviderandbrowser.webAuthenticationProxy. - You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact sentence you are asking about, and we will fix or clarify it.