Merge remote-tracking branch 'upstream' into v1.3.8-staging

This commit is contained in:
Alex Yang
2025-09-03 17:37:24 -07:00
2 changed files with 70 additions and 1 deletions

View File

@@ -66,6 +66,17 @@ import { auth } from "../../../lib/auth";
export const GET = oAuthDiscoveryMetadata(auth);
```
### OAuth Protected Resource Metadata
Add a route to expose protected resource metadata for MCP clients:
```ts title=".well-known/oauth-authorization-server/route.ts"
import { oAuthProtectedResourceMetadata } from "better-auth/plugins";
import { auth } from "@/lib/auth";
export const GET = oAuthProtectedResourceMetadata(auth);
```
### MCP Session Handling
You can use the helper function `withMcpAuth` to get the session and handle unauthenticated calls automatically.