MCPcopy Create free account
hub / github.com/AnswerOverflow/AnswerOverflow / signIn

Function signIn

packages/core/src/auth.ts:441–473  ·  view source on GitHub ↗
({ user, account })

Source from the content-addressed store, hash-verified

439 },
440 // TODO: Ugly
441 async signIn({ user, account }) {
442 console.log(`Sign in user: ${user.id}`);
443 if (!account) {
444 return true;
445 }
446 const identifyAccount = async () => {
447 Analytics.linkAnalyticsAccount({
448 answerOverflowAccountId: user.id,
449 otherId: account.providerAccountId,
450 });
451 if (account?.provider === 'discord' && account?.access_token) {
452 const discordAccount = await getDiscordUser({
453 accessToken: account.access_token,
454 });
455 Analytics.identifyDiscordAccount(user.id, {
456 id: discordAccount.id,
457 username: discordAccount.username,
458 email: discordAccount.email ?? '',
459 });
460 }
461 return Analytics.finishAnalyticsCollection();
462 };
463 const updateAccountInfo = async () => {
464 const foundAccount = await findAccountByProviderAccountId({
465 provider: account.provider,
466 providerAccountId: account.providerAccountId,
467 });
468 if (!foundAccount) return;
469 return updateProviderAuthToken(account);
470 };
471 await Promise.all([identifyAccount(), updateAccountInfo()]);
472 return true;
473 },
474 },
475 cookies: {
476 sessionToken: {

Callers 2

SignInButtonFunction · 0.85
ClientAutoSignInFunction · 0.85

Calls 2

identifyAccountFunction · 0.85
updateAccountInfoFunction · 0.85

Tested by

no test coverage detected