HTTP 405 trying to load well-known OAuth metadata
Describe the bug
When attempting to walk through the auth flow for my server, I get the following:
HTTP 405 trying to load well-known OAuth metadata
This seems to be directly related to: https://github.com/modelcontextprotocol/typescript-sdk/issues/744
To Reproduce
Steps to reproduce the behavior:
- Have an OAuth server in the protected metadata at a trailing path like so:
my-org.okta.com/oauth/abc123 - Attempt to walk through OAuth
- Notice error
- Open console and see the following:
OAuth flow error: Error: HTTP 405 trying to load well-known OAuth metadata
discoverOAuthMetadata http://localhost:6274/assets/index-CPgI0-gs.js:16611
Expected behavior
OAuth flow to work with any auth server provider
Hmm, it looks like https://github.com/modelcontextprotocol/typescript-sdk/pull/652 added OIDC Discovery support and version 0.16.2 pulled in that update, but this bug still exists in inspector.
I see the PR is already up to fix it.
Faced this issue when using okta as authorization server, for temporary fix,
- I cloned the inspector repo
- Opened the node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js
- Updated the order of
urlsToTryinbuildDiscoveryUrlsfunction, updated last one to first - ran
npm run devfrom the repo instead of inspector command
Adding this, just in case someone is facing this issue
Hi @sbbeez, I see you mentioned a PR here, could you link to which PR you're referring to related to resolving this issue? Thanks!