Svelte Google Auth
<script lang="ts">
import { GoogleAuth } from "@beyonk/svelte-social-auth";
const GOOGLE_CLIENT_ID =
"643332836412-964d72e72d053d501f2949969849b96c.apps.googleusercontent.com";
</script>
<GoogleAuth
clientId={GOOGLE_CLIENT_ID}
on:auth-success={(e) => console.dir(e.detail.user)}
>
<button>Войти</button>
</GoogleAuth>
Траблшутинг
- В случае ошибки
Unknown file extension ".svelte" for ...
фиксим так:
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vitest/config';
export default defineConfig({
plugins: [sveltekit()],
...
optimizeDeps: {
exclude: ['svelte-social-auth']
}
});
Альтернативы