A prompt is three decisions at once

A location dialog appears before a single map tile renders. That pause is easy to read as a technical step, a box to clear before the real work starts. It is better read as the moment three separate parties settle a boundary. A host decides which capabilities exist behind its bridge at all. A mini program declares a purpose and asks at a specific moment. A person grants, declines, or later takes the grant back. The code that follows the dialog only makes sense when all three are in view.

The host writes the menu

Take WeChat's model, which is first-party documentation for that host and nothing more universal than that. Capabilities requiring consent are grouped into named scopes: precise, fuzzy, and background location, microphone, camera, Bluetooth, adding to the photo album, contacts, calendar, WeChat sports, address, invoice, user profile, and others (last edited 2026-07-28). A grant applies to a scope, and every interface under that scope becomes callable once the grant exists. That grouping is a design choice made by one host. It is not a law of mini programs, and it should not be copied into a different host's model as if it were.

Three states, three code paths

The same document describes three states a call can encounter. When nothing has been asked or answered, a dialog appears and the call proceeds only after consent. When a grant already exists, the interface is called directly. When consent has been refused, no dialog appears and the call enters the interface's failure callback; the documentation explicitly asks developers to handle that case. The authorization record survives until the person deletes the mini program, and two interfaces support the loop: wx.getSetting reads the current state, and wx.openSetting directs the person to the settings surface where a grant can be changed. Treating the refusal path as an error to be suppressed is the common failure here. A declined camera scope is a normal state of the system, not an exception.

Ask at the moment of need

Minimal privilege is a timing rule as much as a scope rule. The guidance from that same host is to request only when an authorized interface is genuinely about to be used, and to state the reason inside the request. wx.authorize allows a request to be raised before the call, while the dialog itself carries the purpose text recorded in the mini program's privacy protection guideline. A background location scope shows how tightly timing and version interact: in WeChat, scope.userLocationBackground can raise a background location dialog from Android 8.0.0 and iOS 8.0.0 onward; below those versions no dialog appears and the person has to set location access to the during-and-after option in settings. Host capability, OS floor, and human action sit in one line of behavior. No claim is made here about a separate Android-side comparison; the version floors are quoted from WeChat's own document.

The OS has its own model

Apple's documentation describes a different layer, an OS-level model for iOS and macOS 10.14 and later. Camera and microphone access requires an explicit per-app grant. A system alert appears before first use, and purpose strings must be present in Info.plist, including NSCameraUsageDescription, NSMicrophoneUsageDescription, NSPhotoLibraryUsageDescription, and NSPhotoLibraryAddUsageDescription. macOS also requires Camera and Audio Input entitlements, and a missing entitlement ends the process. Before configuring a capture session, the documented pattern is to read AVCaptureDevice.authorizationStatus(for:), then call requestAccess(for:completionHandler:) only when the status is notDetermined. The system remembers the answer, and the person can change it later in system settings. This is an operating system contract, not something a mini program runtime implements on its own.

Revocation is a lifecycle

The web platform adds a third vocabulary. MDN documents that Permissions.query() returns a PermissionStatus with granted, denied, or prompt; the last one means a decision is still owed, not that access exists. The feature has been cross-browser since September 2022 and works inside Web Workers, but not every API's status can be queried, so per-item probing with navigator.permissions.query() is the safe pattern. A once-proposed Permissions.revoke() was removed from browsers that shipped it; removing a site grant became a manual action in browser settings. The W3C Permissions document, an Editor's Draft dated 2026-11-16 and explicitly marked work in progress, goes further: PermissionStatus.onchange re-runs the query algorithm and dispatches a change event; permissions carry a lifetime after which state returns to a default that is usually prompt; and a revoke algorithm removes the matching permission-store entry. A draft reflects a direction of travel, and publication does not mean W3C endorsement, so it should never be presented as a settled standard.

ModelWhere the grant is heldHow a change reaches the program
WeChat scopes (one host)Record kept by that host until the mini program is deletedwx.getSetting; refusal enters the interface failure callback
Apple AVFoundation (OS level)System-wide per-app decision, remembered by the OSauthorizationStatus(for:) plus changes in system settings
Web Permissions API (platform direction)Browser permission store per originPermissions.query() and PermissionStatus.onchange

What the three-way frame changes

Reading permission as negotiation changes the questions worth asking. Which capabilities does this host expose at all, and which stay behind its bridge? Which purpose text will a person see at the exact moment of the request? What does the interface do when the answer is no, and what happens if the answer changes a week later? None of these are solved by a single boolean in configuration. They are decisions distributed across a host, a package, and a person, and each one needs an observable path in code. A grant that can be revoked should be modeled as a state with transitions, not as a flag read once at startup.

Few projects make that distribution as visible as one runtime shared by many mini programs, where the host's exposure choices and the person's grants sit on opposite sides of the same bridge. Cross Mini App treats the grant boundary as part of the runtime contract, so a refusal, a host version floor, and a later revocation all have a defined place in the design rather than a patch after release.

Sources

  1. WeChat authorization scopes and three-state behavior
  2. Apple: requesting authorization to capture and save media
  3. MDN Permissions API
  4. W3C Permissions, Editor's Draft