[auth] OAuth protected-resource-metadata: fallback on 4xx not just 404#879
Merged
[auth] OAuth protected-resource-metadata: fallback on 4xx not just 404#879
Conversation
domdomegg
reviewed
Aug 15, 2025
src/client/auth.test.ts
Outdated
|
|
||
| it("falls back to root discovery when path-aware discovery returns 404", async () => { | ||
| // First call (path-aware) returns 404 | ||
| it("falls back to root discovery when path-aware discovery fails", async () => { |
Member
There was a problem hiding this comment.
maybe we could make this a parameterised test (with it.each) to check across many 4xx statuses?
domdomegg
reviewed
Aug 15, 2025
Co-authored-by: adam jones <[email protected]>
ochafik
approved these changes
Aug 19, 2025
src/client/auth.test.ts
Outdated
|
|
||
| it("falls back to root discovery when path-aware discovery returns 404", async () => { | ||
| // First call (path-aware) returns 404 | ||
| it("falls back to root discovery when path-aware discovery fails", async () => { |
Contributor
There was a problem hiding this comment.
could also be good to add "falls back when path-aware discovery encounters internal server error" (to check the 500s are left out of the logic)
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.
Motivation and Context
Some places will return a 401 or other 4xx status code when you probe for a metadata endpoint they don't support. Prior to this, we'd only fallback specifically on a 404, but if it's unauthorized, you're not guaranteed to get a 404.
Without this change, clients will fail trying to get the path-aware version and never try the supported root PRM path.
How Has This Been Tested?
Added tests
Breaking Changes
Unbreaks a change from introducing path-aware metadata
Types of changes
Checklist
Additional context