MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / createOAuthState

Function createOAuthState

apps/web/src/lib/integrations/oauth-state.ts:50–65  ·  view source on GitHub ↗
(owner: string, userId: string, returnTo?: string)

Source from the content-addressed store, hash-verified

48/**
49 * Build a signed OAuth state parameter.
50 *
51 * @param owner – owner string, e.g. `user_abc123` or `org_xyz789`
52 * @param userId – the ID of the currently-authenticated user initiating the flow
53 */
54export function createOAuthState(
55 owner: string,
56 userId: string,
57 returnTo?: string,
58 purpose?: 'provider_install'
59): string {
60 const safeReturnTo = returnTo ? validateReturnPath(returnTo) : null;
61 return createSignedToken({
62 owner,
63 uid: userId,
64 ...(safeReturnTo ? { returnTo: safeReturnTo } : {}),
65 ...(purpose ? { purpose } : {}),
66 });
67}
68

Callers 8

createGoogleOAuthStateFunction · 0.90
createGitLabOAuthStateFunction · 0.90
route.test.tsFile · 0.90
route.test.tsFile · 0.90

Calls 3

validateReturnPathFunction · 0.90
signFunction · 0.70
toStringMethod · 0.65

Tested by

no test coverage detected