Package options reference

What package options are for

Package options control settings shared by the whole R process, including network timeouts and diagnostic logging. oauth_client() and oauth_module_server() arguments apply to one app registration or module. The Usage guide covers login setup.

Set an option at app startup

For example, give a slow provider up to ten seconds per network request. Put this near the top of app.R, before creating the provider and client:

options(shinyOAuth.timeout = 10)

A longer timeout gives a slow provider more time to respond, but delays failure when the service is unavailable. Restore the default with options(shinyOAuth.timeout = NULL).

Options affect every session sharing that R process; they are app-wide settings rather than per-user settings.

Times use seconds unless a setting explicitly says milliseconds.

Logging

These options control diagnostic events and the request details they contain.

See Audit logging for R hook examples and OpenTelemetry for log and trace exporter setup.

HTTP settings (timeout, retries, user agent)

Network settings limit request duration and response size.

Async timeout (mirai)

A task timeout limits how long background work may run. Configure workers first, as shown in Usage.

Async condition replay

Background workers can return warnings and messages to the app. Turn replay off if another logging system already handles those diagnostics.

Token lifetime fallback

Some providers omit the token lifetime. This fallback lets ordinary OAuth clients track expiry in that case.

Validation and URL policy

These settings control which token responses and addresses the app accepts.

allowed_hosts patterns support globs (*, ?). For example, c(".example.com") matches the domain and its subdomains; "*" accepts any host.

State store

Pending login records let the app recognize the returning browser. Shared stores must consume each record only once, even when several R processes handle requests.

Size caps

State envelope

These limits keep oversized state parameters from using excessive CPU or memory during decoding and decryption.

Callback query

These limits reject oversized callback URLs and POST bodies before they cause excessive processing or logging.

Generated login state must fit both shinyOAuth.callback_max_state_bytes and the state envelope limits above. Their outer-token defaults both allow 8192 bytes (base64url state is ASCII). Lowering either limit can restrict ordinary logins with many scopes or other state metadata. prepare_call() checks both budgets before storing pending login state, publishing a Request Object, or sending PAR.

Configuration assessments

Use check_oauth21(client) to review settings without making requests or changing the app. The report separates configuration problems, recommendations and things that need deployment testing. See check_oauth21() for an example and the specification revision assessed.

Local debugging

Advanced transport constraints

Response limits cover both downloaded and decoded gzip data; other encodings are rejected. Use perform_resource_req(token, request) to retain the decoded size limit, adding client for DPoP or mTLS. Direct httr2::req_perform() uses httr2’s transport settings instead.

Advanced parameter overrides

Overrides allow selected extra parameters beyond the normal client and provider arguments.

By default, shinyOAuth blocks security-critical parameters in extra_auth_params, extra_token_params, and extra_token_headers to protect state binding, PKCE and client authentication from accidental overrides.

Set the callback format with oauth_client(response_mode = ...).