OAuth request hardening
OAuth request hardening
Always generate and verify
state to prevent CSRF attacksAlways generate and verify
nonce when requesting id_tokenUse PKCE (
S256) for every public client (SPA, mobile, desktop)Register exact redirect URIs — no wildcards, no trailing-slash variations
Token storage and handling
Token storage and handling
Treat
access_token, access_token_jwt, and refresh_token as secretsPrefer server-side token storage (HTTP-only cookies, encrypted session)
If browser storage is necessary, use
sessionStorage over localStorage — never localStorage for refresh tokensRotate app sessions after a refresh or privilege change
ID token validation
ID token validation
When validating an
id_token JWT received from Ave, check all of the following:Signature valid against JWKS from the Ave OIDC discovery document (
{issuer}/.well-known/jwks.json, where issuer is the issuer value from /.well-known/openid-configuration)iss equals the issuer value from the Ave OIDC discovery document (e.g. https://aveid.net on the hosted service)aud equals your clientId (or origin:https://yourapp.com for Quick Ave)exp is in the futureiat is recent (within an acceptable clock skew)nonce matches the value you sent at authorization timeReject tokens with missing or unexpected values for any of the above
Keep your service clocks synchronized (NTP). JWT validation is time-sensitive — a clock that’s off by more than a few minutes will cause false rejections or accept expired tokens.
Connector (delegation) safety
Connector (delegation) safety
Request the minimum set of connector scopes your app actually needs
Pin to known
requestedResource values — don’t accept arbitrary resource keys from user inputHandle
access_denied on token exchange as a normal user action (grant was revoked), not a system errorNever cache delegated tokens past their
expires_in timeSigning safety
Signing safety
Include an anti-replay nonce or a unique operation ID in every signed payload
Set short expiration times for signing requests (default 300 s, max 3600 s)
Verify signatures server-side before performing any irreversible action
Use canonical, deterministic payload strings to avoid signature-mismatch bugs
E2EE key safety
E2EE key safety
Normalize base64 fragments before decoding — replace
(space) with +Remove key-bearing URL fragments from browser history immediately after parsing
Keep per-identity encrypted data partitions — never mix data across identities
Never log raw key material
Use the embed SDK for iframe flows; it only accepts
postMessage from the Ave issuerOperational monitoring
Operational monitoring
Monitor spikes in
invalid_grant errors — may indicate token replay or reuse attacksMonitor spikes in
invalid_scope errors — may indicate misconfigured clients or probingTrack refresh token failure patterns to detect stolen tokens
Alert on unusual signing denial/approval anomalies
Rotate app credentials (
clientSecret) periodically