reusable generateOAuthState helper, introduce in InspectorOAuthClientProvider and in oauth-state-machine, add test

This commit is contained in:
Konstantin Konstantinov 2025-08-11 21:24:26 +03:00
commit 929b930618
No known key found for this signature in database

View file

@ -8,6 +8,7 @@ import {
OAuthMetadata,
} from "@modelcontextprotocol/sdk/shared/auth.js";
import { SESSION_KEYS, getServerSpecificKey } from "./constants";
import { generateOAuthState } from "@/utils/oauthUtils";
export const getClientInformationFromSessionStorage = async ({
serverUrl,
@ -75,6 +76,10 @@ export class InspectorOAuthClientProvider implements OAuthClientProvider {
return window.location.origin + "/oauth/callback";
}
state(): string | Promise<string> {
return generateOAuthState();
}
get clientMetadata(): OAuthClientMetadata {
return {
redirect_uris: [this.redirectUrl],