@@ -3,6 +3,7 @@ import {kindeConfiguration} from '$lib/index.js';
3
3
import { parseSearchParamsToObject } from '$lib/utils/index.js' ;
4
4
import type { SessionManager } from '@kinde-oss/kinde-typescript-sdk' ;
5
5
import { error , redirect , type RequestEvent } from '@sveltejs/kit' ;
6
+ import { version } from '$app/environment' ;
6
7
7
8
export async function handleAuth ( {
8
9
request,
@@ -15,6 +16,32 @@ export async function handleAuth({
15
16
case 'login' :
16
17
url = await kindeAuthClient . login ( request as unknown as SessionManager , options ) ;
17
18
break ;
19
+ case 'health' :
20
+ if ( ! kindeConfiguration . debug ) {
21
+ url = new URL ( kindeConfiguration . loginRedirectURL ) ;
22
+ break ;
23
+ }
24
+ return new Response (
25
+ JSON . stringify ( {
26
+ authDomain : kindeConfiguration . authDomain || '' ,
27
+ clientId : kindeConfiguration . clientId || '' ,
28
+ logoutRedirectURL : kindeConfiguration . logoutRedirectURL || '' ,
29
+ redirectURL : kindeConfiguration . redirectURL || '' ,
30
+ audience : kindeConfiguration . audience || '' ,
31
+ scope : kindeConfiguration . scope || '' ,
32
+ clientSecret : kindeConfiguration . clientSecret . match ( '[a-z0-9]{32}' )
33
+ ? 'Set correctly'
34
+ : 'Not set correctly' ,
35
+ loginRedirectURL : kindeConfiguration . loginRedirectURL || '' ,
36
+ authUsePKCE : kindeConfiguration . authUsePKCE ,
37
+ version : version ,
38
+ framework : 'sveltekit'
39
+ } ) ,
40
+ {
41
+ status : 200 ,
42
+ headers : { 'Content-Type' : 'application/json' }
43
+ }
44
+ ) ;
18
45
case 'register' :
19
46
url = await kindeAuthClient . register ( request as unknown as SessionManager , options ) ;
20
47
break ;
0 commit comments