MCPcopy Create free account
hub / github.com/garrytan/gstack / extractToken

Function extractToken

browse/src/server.ts:470–474  ·  view source on GitHub ↗

Extract bearer token from request. Returns the token string or null.

(req: Request)

Source from the content-addressed store, hash-verified

468
469/** Extract bearer token from request. Returns the token string or null. */
470function extractToken(req: Request): string | null {
471 const header = req.headers.get('authorization');
472 if (!header?.startsWith('Bearer ')) return null;
473 return header.slice(7);
474}
475
476/** Validate token and return TokenInfo. Returns null if invalid/expired. */
477function getTokenInfo(req: Request): TokenInfo | null {

Callers 3

getTokenInfoFunction · 0.85
isRootRequestFunction · 0.85
makeFetchHandlerFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected