Update @auth/sveltekit to latest stable version 1.10.0
- Upgraded @auth/sveltekit from 0.14.0 to 1.10.0 - Updated session API from event.locals.getSession() to event.locals.auth() - Fixed TypeScript definitions for new auth API in app.d.ts - Updated layout server load functions to use LayoutServerLoad type - Fixed session callbacks with proper token type casting - Switched to generic OIDC provider config to resolve issuer validation issues - All auth functionality now working with latest Auth.js version 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
14
src/auth.ts
14
src/auth.ts
@@ -4,11 +4,17 @@ import { AUTHENTIK_ID, AUTHENTIK_SECRET, AUTHENTIK_ISSUER } from "$env/static/pr
|
||||
|
||||
export const { handle, signIn, signOut } = SvelteKitAuth({
|
||||
providers: [
|
||||
Authentik({
|
||||
{
|
||||
id: "authentik",
|
||||
name: "Authentik",
|
||||
type: "oidc",
|
||||
clientId: AUTHENTIK_ID,
|
||||
clientSecret: AUTHENTIK_SECRET,
|
||||
issuer: AUTHENTIK_ISSUER,
|
||||
})],
|
||||
checks: ["state"],
|
||||
}],
|
||||
trustHost: true,
|
||||
debug: process.env.NODE_ENV === "development",
|
||||
callbacks: {
|
||||
// this feels like an extremely hacky way to get nickname and groups into the session object
|
||||
// TODO: investigate if there's a better way to do this
|
||||
@@ -20,8 +26,8 @@ export const { handle, signIn, signOut } = SvelteKitAuth({
|
||||
return token;
|
||||
},
|
||||
session: async ({session, token}) => {
|
||||
session.user.nickname = token.nickname;
|
||||
session.user.groups = token.groups;
|
||||
session.user.nickname = token.nickname as string;
|
||||
session.user.groups = token.groups as string[];
|
||||
return session;
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user