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 { 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 { GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET } from '$env/static/private';
|
||||||
|
|
||||||
const convexClient = new ConvexHttpClient(process.env.CONVEX_SITE_URL!);
|
const convexClient = new ConvexHttpClient(process.env.CONVEX_SITE_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: {
|
||||||
|
github: {
|
||||||
|
clientId: GITHUB_CLIENT_ID,
|
||||||
|
clientSecret: GITHUB_CLIENT_SECRET
|
||||||
|
}
|
||||||
|
},
|
||||||
plugins: []
|
plugins: []
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,13 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Button from "$lib/components/ui/button/button.svelte";
|
import Button from '$lib/components/ui/button/button.svelte';
|
||||||
import { authClient } from "$lib/backend/auth/client";
|
import { authClient } from '$lib/backend/auth/client';
|
||||||
|
|
||||||
|
async function signInGithub() {
|
||||||
|
await authClient.signIn.social({
|
||||||
|
provider: 'github',
|
||||||
|
callbackURL: '/chat'
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Button onclick={}>
|
<Button onClickPromise={signInGithub}>Sign In Github</Button>
|
||||||
|
|
||||||
</Button>
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue