RFC 10017 recommends keeping OAuth tokens out of the browser
In short
- In August 2026 the Internet Engineering Task Force (IETF) published RFC 10017, "OAuth 2.0 for Browser-Based Applications", as Best Current Practice 212. The authors are Aaron Parecki of Okta, Philippe De Ryck of Pragmatic Web Security and David Waite of Ping Identity.
- It names three architectures and presents them "in decreasing order of security": a Backend for Frontend (BFF) that holds the tokens and forwards every request, a token-mediating backend, and a browser-based OAuth client that does everything itself.
- Its premise is that malicious JavaScript in a page "has the same privileges as the legitimate application code". The less the browser holds, the less an attacker can take.
- For business, sensitive and personal-data applications it "strongly recommends" the BFF, and says the browser-only client is "not recommended".
3 architecture patterns, ranked by security; BCP 212 the document's Best Current Practice number; minutes to hours typical access-token lifetime in a browser client; hours or days how long a refresh token often stays valid
What does OAuth do in a web page?
OAuth 2.0 is the system behind "sign in with a third party" and behind many apps that call an API for you. The app (the client) sends you to an authorization server, you log in there, and the app receives a token. An access token is a short-lived key that a resource server (the API) accepts. A refresh token is a longer-lived key the app can swap for new access tokens without asking you again.
A page running in your browser is a public client: it cannot keep a secret. The RFC says today's best practice is the Authorization Code grant with PKCE, and then asks where the tokens should live.
The threat: code that is not isolated
Section 5 starts from an uncomfortable assumption. Even with output encoding, a Content Security Policy and Subresource Integrity, "there is a risk that the attacker might find a way to trigger the execution of malicious JavaScript" (cross-site scripting, or a compromised third-party script). Once it runs, it can read localStorage and IndexedDB, call functions, and override built-in behaviour.
The RFC lists four things such code can do:
Consequences are ranked too. A stolen refresh token allows "long-term impersonation", and the attack stops only when the server refuses the token because it has expired, rotated or been revoked. The RFC says it is "not uncommon" for a refresh token to stay valid "for multiple hours or even days". A stolen access token gives short-term impersonation, with lifetimes "ranging from minutes to hours". Hijacking the running client is the least powerful, because the attacker is still bound by the client's own policies, such as CORS rules on the server.
Which OAuth design is safest for a web app?
The BFF. The RFC stresses that the BFF is "a component of the frontend application", not an API gateway. It handles the OAuth flow, keeps tokens against a cookie-based session, and attaches the right access token to each request. The browser never sees a token. Because the BFF is a confidential client, script in the page cannot start a new flow to get its own. The RFC says the architecture "ensures that the application's attack surface does not increase by using OAuth": what remains is hijacking the client, "a problem inherent to web applications". The cost is stated openly: it is "significantly more complicated" than a browser-only app, and proxying can add "a significant burden" on servers.
The token-mediating backend. The backend obtains tokens but gives the access token to the page, which calls APIs directly. This stops refresh-token abuse and new-flow attacks, but "the attacker still has the ability to gain direct access to resource servers".
The browser-based client. Simple, and it "results in a significant increase in the attack surface": the attacker can extract "a full-featured set of tokens".
Hardening a browser-only client
For teams that stay with pattern 3, the RFC lists mitigations and is candid about their limits.
- DPoP (RFC 9449). Tokens are bound to a non-extractable key pair kept by the browser (stored in IndexedDB). A stolen token is then useless without the key, and the attacker can only act online through the victim's browser. But script can still run a new flow and bind the fresh tokens to a key it controls.
- Refresh-token rules. Authorization servers must rotate refresh tokens on each use or make them sender-constrained, and must set a maximum lifetime or an inactivity expiry. The RFC's example: an access token of 10 minutes, a refresh token of 8 hours, and a rotated refresh token of 7 hours 50 minutes after the first refresh, so the chain ends 8 hours after the original sign-in.
- Storage. localStorage offers no protection from script on the same origin. A Web Worker can keep the refresh token in memory and hand the page only the access token, which protects the refresh token but not the access token. In the RFC's words, none of the persistent options "can fully mitigate token exfiltration" when the attacker runs code in the app.
Isolating tokens does not close the biggest hole. The RFC repeats that a fully isolated store, a Service Worker or a Web Worker still cannot stop script from running its own Authorization Code flow and getting a fresh set of tokens.
What it rules out
Section 7 lists patterns it discourages or forbids.
- Implicit grant: clients "MUST NOT" use it, and authorization servers must not issue access tokens in the authorization response.
- Password grant: "MUST NOT be used".
- Handling the OAuth flow in a Service Worker: not recommended. It looks promising, but script can unregister the worker, then open a new frame with no worker attached and run its own flow. The RFC adds the "significant complexity" of maintaining one.
- OAuth for a single-domain app: the RFC says simple apps are "made needlessly complex" by using OAuth in place of session management, and a server-side session cookie with OpenID Connect sign-in may be enough.
Terms in plain English
- BFF (Backend for Frontend): a server-side part of the web app that does the OAuth work and calls APIs for the page (the RFC's role, our wording).
- DPoP: a way to tie a token to a private key so a copied token fails without the key.
- XSS: cross-site scripting, a bug that lets an attacker run script in your page.
Where things stand
RFC 10017 is a published Best Current Practice, so it is guidance, not a protocol change. It builds on the OAuth security BCP, RFC 9700, and restricts some of its advice further. We did not check which libraries, identity providers or frameworks follow its three-pattern ranking, so this story makes no claim about adoption.
Sources
- RFC 10017: OAuth 2.0 for Browser-Based Applications, IETF RFC Editor, August 2026
- RFC 10017 information page, IETF RFC Editor
Sources
Related stories
- IETF defines Quality of Outcome, a 0-100% network score per app
- RFC 10094 clarifies SRv6 SID list entries are 128-bit values
- RFC 10087 runs the domain-registry EPP protocol over QUIC
- RFC 10021 lets IoT devices verify who sent a multicast command
- RFC 10063 mirrors routing registry data as signed HTTPS files
- RFC 10073 pairs ML-DSA with RSA, ECDSA or EdDSA in one signature
More from Wi-Fi Wizards
- RFC 9971 describes MLRsearch, an alternative to RFC 2544 testing
- A new HTTP header asks proxies to forward messages as they arrive
- NTP messages can now ride inside PTP packets under RFC 10030
- SSH gets three hybrid post-quantum key exchanges in RFC 10042
- Iran's Internet returns after an 88-day shutdown, Cloudflare says