MCPcopy Create free account
hub / github.com/pollinations/pollinations / putCode

Function putCode

enter.pollinations.ai/test/oauth-code.test.ts:26–42  ·  view source on GitHub ↗

Park an authorization code in KV the way POST /api/oauth/code does.

(
    code: string,
    overrides: Record<string, unknown> = {},
)

Source from the content-addressed store, hash-verified

24
25/** Park an authorization code in KV the way POST /api/oauth/code does. */
26async function putCode(
27 code: string,
28 overrides: Record<string, unknown> = {},
29): Promise<void> {
30 const stored = {
31 key: "sk_test_access_token",
32 clientId: "pk_test_client",
33 redirectUri: REDIRECT_URI,
34 scope: "profile",
35 codeChallenge: await s256(VERIFIER),
36 expiresIn: 604800,
37 ...overrides,
38 };
39 await env.KV.put(`oauth-code:${code}`, JSON.stringify(stored), {
40 expirationTtl: 600,
41 });
42}
43
44function formPost(params: Record<string, string>): RequestInit {
45 return {

Callers 1

oauth-code.test.tsFile · 0.85

Calls 3

s256Function · 0.85
stringifyMethod · 0.80
putMethod · 0.65

Tested by

no test coverage detected