This commit is contained in:
Thomas G. Lopes 2025-06-13 18:33:43 +01:00
parent 8d500cffb0
commit a0ba611df9
4 changed files with 25 additions and 9 deletions

View file

@ -33,6 +33,7 @@
"concurrently": "^9.1.2", "concurrently": "^9.1.2",
"convex": "^1.24.8", "convex": "^1.24.8",
"convex-svelte": "^0.0.11", "convex-svelte": "^0.0.11",
"dotenv": "^16.5.0",
"eslint": "^9.18.0", "eslint": "^9.18.0",
"eslint-config-prettier": "^10.0.1", "eslint-config-prettier": "^10.0.1",
"eslint-plugin-svelte": "^3.0.0", "eslint-plugin-svelte": "^3.0.0",

9
pnpm-lock.yaml generated
View file

@ -60,6 +60,9 @@ importers:
convex-svelte: convex-svelte:
specifier: ^0.0.11 specifier: ^0.0.11
version: 0.0.11(convex@1.24.8)(svelte@5.34.1) version: 0.0.11(convex@1.24.8)(svelte@5.34.1)
dotenv:
specifier: ^16.5.0
version: 16.5.0
eslint: eslint:
specifier: ^9.18.0 specifier: ^9.18.0
version: 9.28.0(jiti@2.4.2) version: 9.28.0(jiti@2.4.2)
@ -1247,6 +1250,10 @@ packages:
dom-accessibility-api@0.6.3: dom-accessibility-api@0.6.3:
resolution: {integrity: sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==} resolution: {integrity: sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==}
dotenv@16.5.0:
resolution: {integrity: sha512-m/C+AwOAr9/W1UOIZUo232ejMNnJAJtYQjUbHoNTBNTJSvqzzDh7vnrei3o3r3m9blf6ZoDkvcw0VmozNRFJxg==}
engines: {node: '>=12'}
emoji-regex@8.0.0: emoji-regex@8.0.0:
resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==}
@ -3337,6 +3344,8 @@ snapshots:
dom-accessibility-api@0.6.3: {} dom-accessibility-api@0.6.3: {}
dotenv@16.5.0: {}
emoji-regex@8.0.0: {} emoji-regex@8.0.0: {}
enhanced-resolve@5.18.1: enhanced-resolve@5.18.1:

View file

@ -1,17 +1,18 @@
import { betterAuth } from 'better-auth'; import { betterAuth } from 'better-auth';
import { convexAdapter } from '@better-auth-kit/convex'; import { convexAdapter } from '@better-auth-kit/convex';
import { ConvexHttpClient } from 'convex/browser'; import { ConvexHttpClient } from 'convex/browser';
import 'dotenv/config';
const convexClient = new ConvexHttpClient(process.env.CONVEX_SITE_URL!); const convexClient = new ConvexHttpClient(process.env.PUBLIC_CONVEX_URL!);
export const auth = betterAuth({ export const auth = betterAuth({
secret: process.env.BETTER_AUTH_SECRET!, secret: process.env.BETTER_AUTH_SECRET!,
database: convexAdapter(convexClient), database: convexAdapter(convexClient),
socialProviders: { socialProviders: {
// github: { github: {
// clientId: process.env.GITHUB_CLIENT_ID!, clientId: process.env.GITHUB_CLIENT_ID!,
// clientSecret: process.env.GITHUB_CLIENT_SECRET! clientSecret: process.env.GITHUB_CLIENT_SECRET!
// } }
}, },
plugins: [] plugins: []
}); });

View file

@ -3,10 +3,15 @@
import { authClient } from '$lib/backend/auth/client'; import { authClient } from '$lib/backend/auth/client';
async function signInGithub() { async function signInGithub() {
await authClient.signIn.social({ try {
provider: 'github', console.log('signInGithub');
callbackURL: '/chat' const data = await authClient.signIn.social({
}); provider: 'github'
});
console.log('signInGithub data', data);
} catch (e) {
console.log('signInGithub error', e);
}
} }
</script> </script>