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

Function parseSignInRedirectContext

apps/web/src/lib/user/server.ts:377–399  ·  view source on GitHub ↗
(
  callbackUrlCookieValue: string | undefined
)

Source from the content-addressed store, hash-verified

375 (profile.given_name && profile.family_name
376 ? `${profile.given_name} ${profile.family_name}`.trim()
377 : profile.given_name || profile.family_name || 'LinkedIn User')
378 );
379}
380
381/**
382 * An OAuth/OIDC sign-in proves ownership of its email only when the provider
383 * asserts the `email_verified` claim in the raw profile. Apple delivers the
384 * claim as the string "true"; treat that as verified. Providers without the
385 * claim (GitHub, GitLab, Discord) never prove the email here.
386 */
387export function profileProvesEmailOwnership(profile: unknown): boolean {
388 const emailVerified = (profile as { email_verified?: unknown } | undefined)?.email_verified;
389 return emailVerified === true || emailVerified === 'true';
390}
391
392function createEmailAccountInfo(
393 account: Account,
394 user: NextUser | AdapterUser
395): CreateOrUpdateUserArgs | null {
396 if (account.provider !== 'email') return null;
397 assert(user.email, 'User email is required for email auth');
398
399 // Extract the actual domain from the email address
400 // This ensures admin detection works correctly for @kilocode.ai emails
401 const emailDomain = user.email.split('@')[1];
402 const hosted_domain = emailDomain || hosted_domain_specials.email;

Callers 2

server.test.tsFile · 0.90
getSignInRedirectContextFunction · 0.85

Calls 2

isValidCallbackPathFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected