Skip to content

Commit

Permalink
fix(console): save client side session into cookie after webauthn, an…
Browse files Browse the repository at this point in the history
…d also use it with houdini
  • Loading branch information
xmlking committed Jun 27, 2024
1 parent d333129 commit cc37494
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions apps/console/src/lib/graphql/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { env } from '$env/dynamic/public';
import { HoudiniClient } from '$houdini';
import type { ClientPlugin } from '$houdini';
import { subscription } from '$houdini/plugins';
import { accessToken as $accessToken } from '$lib/stores/user'
import { get } from 'svelte/store';
import { accessToken as $accessToken } from '$lib/stores/user';
import { Logger, hasErrorMessage, hasErrorTypes, isErrorType } from '@spectacular/utils';
import { error, redirect } from '@sveltejs/kit';
import { createClient as createWSClient } from 'graphql-ws';
import { get } from 'svelte/store';

const url = env.PUBLIC_GRAPHQL_ENDPOINT;

Expand Down
12 changes: 6 additions & 6 deletions apps/console/src/routes/(auth)/signin/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ import { goto } from '$app/navigation';
import { page } from '$app/stores';
import * as m from '$i18n/messages';
import { handleMessage } from '$lib/components/layout/toast-manager';
import { NHOST_SESSION_KEY } from '$lib/constants.js';
import { pwSchema, pwlSchema } from '$lib/schema/user';
import { isLoadingForm } from '$lib/stores/loading';
import { nhost } from '$lib/stores/user';
import { getToastStore } from '@skeletonlabs/skeleton';
import { DebugShell } from '@spectacular/skeleton/components';
import { Icon } from '@spectacular/skeleton/components/icons';
import { Logger } from '@spectacular/utils';
import Cookies from 'js-cookie';
// import { SiGithub } from "@icons-pack/svelte-simple-icons";
import { AlertTriangle, Fingerprint, Github, Loader, Mail, MoreHorizontal } from 'lucide-svelte';
import { fade } from 'svelte/transition';
import SuperDebug, { superForm } from 'sveltekit-superforms';
import { zodClient } from 'sveltekit-superforms/adapters';
import Cookies from 'js-cookie'
import { NHOST_SESSION_KEY } from '$lib/constants.js';
export let data;
const log = new Logger('auth:signin:browser');
Expand Down Expand Up @@ -96,10 +96,10 @@ async function waSignin() {
const { session, error: signInError } = await nhost.auth.signIn({ email: $pwlForm.email, securityKey: true });
if (session) {
Cookies.set(NHOST_SESSION_KEY, btoa(JSON.stringify(session)), {
path: '/',
sameSite: 'strict'
})
goto('/dashboard');
path: '/',
sameSite: 'strict',
});
goto('/dashboard');
} else {
console.log(signInError);
}
Expand Down

0 comments on commit cc37494

Please sign in to comment.