more
This commit is contained in:
parent
f2fc79e810
commit
2b3e04ec63
2 changed files with 17 additions and 5 deletions
|
|
@ -1,11 +1,18 @@
|
|||
import { betterAuth } from 'better-auth';
|
||||
import { convexAdapter } from '@better-auth-kit/convex';
|
||||
import { ConvexHttpClient } from 'convex/browser';
|
||||
import { GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET } from '$env/static/private';
|
||||
|
||||
const convexClient = new ConvexHttpClient(process.env.CONVEX_SITE_URL!);
|
||||
|
||||
export const auth = betterAuth({
|
||||
secret: process.env.BETTER_AUTH_SECRET!,
|
||||
database: convexAdapter(convexClient),
|
||||
socialProviders: {
|
||||
github: {
|
||||
clientId: GITHUB_CLIENT_ID,
|
||||
clientSecret: GITHUB_CLIENT_SECRET
|
||||
}
|
||||
},
|
||||
plugins: []
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
<script lang="ts">
|
||||
import Button from "$lib/components/ui/button/button.svelte";
|
||||
import { authClient } from "$lib/backend/auth/client";
|
||||
import Button from '$lib/components/ui/button/button.svelte';
|
||||
import { authClient } from '$lib/backend/auth/client';
|
||||
|
||||
async function signInGithub() {
|
||||
await authClient.signIn.social({
|
||||
provider: 'github',
|
||||
callbackURL: '/chat'
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<Button onclick={}>
|
||||
|
||||
</Button>
|
||||
<Button onClickPromise={signInGithub}>Sign In Github</Button>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue