github 0auth fixes

This commit is contained in:
-Puter
2026-07-31 19:29:00 +05:30
parent fc8cfabacb
commit fc1d0b6916
5 changed files with 80 additions and 55 deletions
+6 -1
View File
@@ -17,8 +17,13 @@ export const authComponent = createClient<DataModel>(components.betterAuth);
const createAuth = (ctx: GenericCtx<DataModel>) =>
betterAuth({
account: {
accountLinking: {
allowDifferentEmails: true,
},
},
advanced: { useSecureCookies: siteUrl.startsWith("https://") },
baseURL: env.CONVEX_SITE_URL,
baseURL: siteUrl,
database: authComponent.adapter(ctx),
emailAndPassword: {
enabled: true,
+4 -4
View File
@@ -80,13 +80,13 @@ const fetchGiteaUser = async (
);
}
const user = (await response.json()) as {
readonly email?: string;
readonly email?: string | null;
readonly id: number;
readonly login: string;
};
return {
externalAccountId: String(user.id),
externalEmail: user.email,
externalEmail: user.email ?? undefined,
externalUsername: user.login,
};
};
@@ -105,13 +105,13 @@ const fetchGithubUser = async (token: string): Promise<ExternalUserInfo> => {
);
}
const user = (await response.json()) as {
readonly email?: string;
readonly email?: string | null;
readonly id: number;
readonly login: string;
};
return {
externalAccountId: String(user.id),
externalEmail: user.email,
externalEmail: user.email ?? undefined,
externalUsername: user.login,
};
};