Document redirect URI matching rules and the loopback port exception - #2680
Merged
Conversation
The OAuth authorization endpoint now accepts any port for http loopback redirect URIs (RFC 8252 §7.3 / OAuth 2.1), so native apps, CLIs and MCP clients can register a port-less http://localhost/callback and bind an ephemeral port at request time. Everything else still requires an exact match.
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
coyotte508
commented
Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The OAuth authorization endpoint now accepts any port for http loopback redirect URIs (RFC 8252 §7.3 / OAuth 2.1), so native apps, CLIs and MCP clients can register a port-less http://localhost/callback and bind an ephemeral port at request time. Everything else still requires an exact match.
Doc page
Note
Low Risk
Documentation-only changes with no runtime or security behavior modifications in this diff.
Overview
Documents how Hugging Face Hub OAuth treats
redirect_urion authorization requests: it must exactly match a registered redirect URI, with one exception for HTTP loopback URIs per RFC 8252 §7.3 / OAuth 2.1.Adds a Redirect URIs section explaining that apps can register port-less loopback callbacks (e.g.
http://localhost/callback) and use whatever ephemeral port the OS assigns at request time. It also clarifies limits: the port exception applies only tohttponlocalhost/127.0.0.1/[::1];httpsand custom schemes still need exact matches; loopback hostnames are not interchangeable; only the port may differ (path, query, userinfo must match).Updates the CIMD / automated OAuth app section with an example of listing port-less loopback URIs in
redirect_urisfor native apps and MCP clients, with a link to the new section.Reviewed by Cursor Bugbot for commit 767cd10. Bugbot is set up for automated code reviews on this repo. Configure here.