Skip to content

Conversation

@4t8dd
Copy link
Contributor

@4t8dd 4t8dd commented Nov 27, 2025

fix of issue #2680

Add clear, actionable error messages when OAuth providers do not support
Dynamic Client Registration (DCR), helping users understand why authentication
fails and how to configure client credentials manually.

Changes:
- Detect missing registration_endpoint in OIDC discovery document
- Recognize HTTP status codes indicating DCR is unavailable (404, 405, 501)
- Provide actionable guidance directing users to --remote-auth-client-id and --remote-auth-client-secret flags
- Add comprehensive test coverage for all DCR unsupported scenarios

Error message improvements:
- Before: "dynamic client registration failed with status 404: {...}"
- After: "this provider does not support Dynamic Client Registration (DCR) - HTTP 404. Please configure OAuth client credentials using --remote-auth-client-id and --remote-auth-client-secret flags, or register a client manually with the provider"

Fixes stacklok#2680

Signed-off-by: 4t8dd <wanger.xyz@gmail.com>
Signed-off-by: 4t8dd <wanger.xyz@gmail.com>
@4t8dd
Copy link
Contributor Author

4t8dd commented Nov 27, 2025

@ChrisJBurns Hi Chris, please help review.

@github-actions github-actions bot added the size/XS Extra small PR: < 100 lines changed label Nov 27, 2025
@codecov
Copy link

codecov bot commented Nov 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.09%. Comparing base (5093c91) to head (7594850).
⚠️ Report is 20 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2757      +/-   ##
==========================================
+ Coverage   56.07%   56.09%   +0.01%     
==========================================
  Files         319      319              
  Lines       30697    30708      +11     
==========================================
+ Hits        17214    17226      +12     
+ Misses      12002    12001       -1     
  Partials     1481     1481              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jhrozek
Copy link
Contributor

jhrozek commented Nov 27, 2025

@amirejaz 👀

@amirejaz
Copy link
Contributor

@amirejaz 👀

From the logs point of view this looks good, and it won’t notify the user as this will log in the detach proxy. However, I was hoping for a more interactive way to let the user know. Maybe we need to set a state that the UI can use to prompt the user to choose another authentication method. In CI, the user can see this state via thv list.

@amirejaz
Copy link
Contributor

@4t8dd This is a good improvement. I’m not entirely sure that adding a DCRUnsupported (or equivalent) state is the best approach. We can go ahead and merge this and continue discussing a more interactive solution. In any case, we will still need to update the logs.

@dmjb any thoughts?

@4t8dd
Copy link
Contributor Author

4t8dd commented Nov 28, 2025

@4t8dd This is a good improvement. I’m not entirely sure that adding a DCRUnsupported (or equivalent) state is the best approach. We can go ahead and merge this and continue discussing a more interactive solution. In any case, we will still need to update the logs.

@dmjb any thoughts?

yes, let's have this at this time and I will keep working and improve this.

@amirejaz amirejaz merged commit 80ebee6 into stacklok:main Nov 28, 2025
30 checks passed
@amirejaz
Copy link
Contributor

Thanks, @4t8dd! I’ve merged this PR and left the issue open. I’ll discuss the proper approach with the team and share the details here once we have a direction. If you’re interested in implementing it, you’re more than welcome to jump in.

In the meantime, here’s a collection of good first issues you might enjoy exploring: https://github.com/stacklok/toolhive/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22good%20first%20issue%22

Thanks again!

@ChrisJBurns
Copy link
Collaborator

Good stuff, thanks @4t8dd for the contribution!! 🚀

@4t8dd
Copy link
Contributor Author

4t8dd commented Nov 29, 2025

Thanks, @4t8dd! I’ve merged this PR and left the issue open. I’ll discuss the proper approach with the team and share the details here once we have a direction. If you’re interested in implementing it, you’re more than welcome to jump in.

In the meantime, here’s a collection of good first issues you might enjoy exploring: https://github.com/stacklok/toolhive/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22good%20first%20issue%22

Thanks again!

yes, definitly. I would like to figiure this out so that I can deploy this in our env for the test.
Any info, please be kind share. Thanks.

@4t8dd 4t8dd deleted the issue-2680 branch November 29, 2025 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS Extra small PR: < 100 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants