MCPcopy Create free account
hub / github.com/modelcontextprotocol/inspector / generateOAuthState

Function generateOAuthState

client/src/utils/oauthUtils.ts:61–68  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59 * @returns A random state for the OAuth 2.0 flow.
60 */
61export const generateOAuthState = () => {
62 // Generate a random state
63 const array = new Uint8Array(32);
64 crypto.getRandomValues(array);
65 return Array.from(array, (byte) => byte.toString(16).padStart(2, "0")).join(
66 "",
67 );
68};
69
70/**
71 * Generates a human-readable error description from OAuth callback error parameters

Callers 3

oauthUtils.test.tsFile · 0.90
stateMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected