Skip to content
This repository was archived by the owner on Nov 21, 2025. It is now read-only.

Commit ee05e8c

Browse files
committed
feat: add getSession utility in order to access a session on the server
1 parent 6308467 commit ee05e8c

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"require": "./src/index.jsx",
2828
"solid": "./src/index.jsx"
2929
},
30-
"./api/*": "./src/api/*"
30+
"./api/*": "./src/api/*",
31+
"./server": "./src/server/index.js"
3132
},
3233
"main": "src/index.js",
3334
"types": "./src/index.d.ts",

src/index.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ declare module '@zentered/auth0-solid-start/api/logout' {
88
export default function (req: APIEvent['request']): void
99
}
1010

11+
declare module '@zentered/auth0-solid-start/server' {
12+
import type { ServerFunctionEvent } from 'solid-start/server'
13+
import type { Session } from 'solid-start/session/sessions'
14+
15+
export function getSession(event: ServerFunctionEvent): Promise<Session>
16+
}
17+
1118
declare module '@zentered/auth0-solid-start' {
1219
import { Accessor, JSX } from 'solid-js'
1320
import type { WebAuth } from 'auth0-js'

src/server/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { storage } from '../session'
2+
export const getSession = async (event) =>
3+
storage.getSession(event.request.headers.get('Cookie'))

0 commit comments

Comments
 (0)