feat: add withOAuthProtectedResource - #113
Conversation
commit: |
withOAuthProtectedResource
cb979a0 to
71af0c0
Compare
|
@raulb While rebasing this onto |
|
oh one more thing @raulb. Not a blocker. VSCode and Claude Code don't read the WWW-Authenticate hint. They probe |
@mandarini thank you! will review
@mandarini it was not on my radar. Scanned Linear and spotted this other issue. Is this what you're referring to? https://linear.app/supabase/issue/FDBKIN-15575/allow-hosting-well-known-endpoints-at-the-project-root-for-edge |
|
@mandarini validated this with https://github.com/supabase-community/edge-function-mcp-sandbox/pull/9 and everything's working. I'll keep working on some other items separately, but let me know if this PR needs any more additional work. Thank you! |
|
@raulb Yes, that's exactly it. Clients that skip the WWW-Authenticate hint (VSCode, Claude Code) can only discover auth through a root-level /.well-known endpoint, so that ticket is the platform-side half of what this middleware does. One detail for whenever it gets built: the proxy will rewrite root probes to some internal path, and that target has to match what this middleware serves (today /{fn}/oauth-protected-resource), or the middleware can serve both. Nothing more needed on this PR from my side. Approving. |
What kind of change does this PR introduce?
Fixes AI-1071
What is the current behavior?
withOAuthProtectedResource(RFC 9728 OAuth Protected Resource middleware, metadata route + 401 enrichment) lives in https://github.com/supabase-community/edge-function-mcp-sandbox.What is the new behavior?
Adds
withOAuthProtectedResource,resourceMetadataResponse, andunauthorizedResponseas a new top-level module (src/oauth-protected-resource/), exported from the package root. Docs/examples are generalized.Additional context
This other PR updates its code to make use of this new function, updating the
notes-appexample over to this package.