Proposal: allow localhost redirect URIs in the localhost dev exception in the OAuth spec
#5255
Replies: 4 comments 4 replies
-
|
I'm all for it! It's a small thing that comes up a lot in development experience, and since the whole |
Beta Was this translation helpful? Give feedback.
-
|
can i chime into bring up something semi unrelated yet makes the dev experience around oauth painful? oauth scope cache and the did cache for atproto services on the reference pds only bust cache every 30 minutes, and theres no manual way to bust the cache. what this means is that unless if you edit the db, you are stuck with scopes/a did for 30 minutes you are unable to change if you misconfigured it/want to change it/want to add more scopes which is really frustrating unless you use an account on an entirely separate pds. |
Beta Was this translation helpful? Give feedback.
-
|
Yup, makes perfect sense! I was just very confused about this 2 days ago :) Not sure if that makes sense, but as I understand the client_id has to be |
Beta Was this translation helpful? Give feedback.
-
|
seems like a lot of people are running into this lately, sounds like a good idea! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
This is a proposal carrying on discussion from this closed PR: bluesky-social/atproto-website#709. There is also a corresponding open issue, bluesky-social/atproto-website#699.
Currently,
http://127.0.0.1is treated differently fromhttp://localhostfor client development, per the OAuth spec in https://atproto.com/specs/oauth#localhost-client-development.This proposal is an opportunity to provide feedback on this change before the team considers implementing it upstream.
What is being proposed
Relax the "Localhost Client Development" exception in the OAuth spec so that
redirect_urivalues may use the hostnamelocalhostin addition to the loopback IP literals127.0.0.1and[::1], and addhttp://localhost/to the defaultredirect_urivalues. Theclient_idrules are unchanged (origin remains exactlyhttp://localhost), as are all production redirect URI rules.Why
Requiring the app under development to be served from
http://127.0.0.1:PORTinstead ofhttp://localhost:PORTis a recurring developer-experience trap:http://localhost:PORT, so that is what developers open.state) is kept in origin-scoped browser storage. When the callback lands on127.0.0.1— a different origin — that state is invisible, and login fails in a way that is hard to diagnose. Both addresses serve the app fine until the login step, which makes the failure look like an SDK bug.localhostvs127.0.0.1mismatches").Security rationale
The loopback-literal preference comes from RFC 8252 §8.3, which is guidance (NOT RECOMMENDED, not prohibited) aimed at native apps binding a local port listener, out of concern that
localhostcould resolve to a non-loopback address on misconfigured systems. That concern does not carry marginal weight in this flow:localhostorigin, so the OAuth callback depends onlocalhostname resolution no more than the application itself does. The IP-literal rule only relocates the callback; it cannot protect an app the developer is browsing atlocalhost. This argument requires no assumptions about browser behavior.http://localhostas a secure context do so on the condition thatlocalhostnames are guaranteed to resolve to the loopback interface (the Secure Contexts spec makes trust conditional on exactly this guarantee; current Chrome, Firefox ≥84, and Safari all provide it).code_verifierand the DPoP key to the session at flow start, and the token endpoint requires both — so an intercepted authorization code cannot be redeemed (verified against the reference@atproto/oauth-providerimplementation, which rejects token requests whose DPoP key does not match the JKT captured at PAR). An attacker who can exfiltrate those secrets from the app has already won regardless of redirect hostname.Most major OAuth providers (GitHub, Google, Auth0, Okta) accept
http://localhostredirect URIs for development.Implementation
@atproto/oauth-provider) would need to acceptlocalhostredirect URIs for the exception.Beta Was this translation helpful? Give feedback.
All reactions