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

Function createEmailAccountInfo

apps/web/src/lib/user/server.ts:315–336  ·  view source on GitHub ↗
(
  account: Account,
  user: NextUser | AdapterUser
)

Source from the content-addressed store, hash-verified

313 const email = (profile as { email?: unknown } | undefined)?.email;
314 const organizationId = (profile as ExtendedProfile | undefined)?.openAiChatGptOrganizationId;
315 const owner: OpenAiChatGptOwner = {
316 kiloUserId: userId,
317 organizationId: organizationId ?? null,
318 };
319 await saveOpenAiChatGptConnection(
320 owner,
321 {
322 access_token: accessToken,
323 ...(account.refresh_token ? { refresh_token: account.refresh_token } : {}),
324 expires_at: account.expires_at ?? Math.floor(Date.now() / 1000) + 3600,
325 ...(account.scope ? { scope: account.scope } : {}),
326 ...(account.token_type ? { token_type: account.token_type } : {}),
327 issuer: OPENAI_ISSUER,
328 client_id: OPENAI_CLIENT_ID,
329 subject,
330 ...(typeof email === 'string' && email ? { email } : {}),
331 connected_at: new Date().toISOString(),
332 status: 'connected',
333 },
334 userId
335 );
336 } catch (error) {
337 captureException(error, {
338 tags: { operation: 'openai_chatgpt_connection_persist' },
339 });

Callers 1

createAccountInfoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected