Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not Working With SvelteKit #40

Open
rakataprime opened this issue Apr 5, 2023 · 1 comment
Open

Not Working With SvelteKit #40

rakataprime opened this issue Apr 5, 2023 · 1 comment

Comments

@rakataprime
Copy link

Hello,

I was unable to use the component with sveltekit v 1.0.0-next.589 with svelte version 3.55.1

It looks like the auth0Promise variable is undefined when using with sveltekit. I'm not sure exactly whats causing this behavior.

This should be able to be reproduced by putting the demo component into a +page.svelte file in any template project. I am also using tailwind css, but i don't think that that should matter.

+page.svelte

<script lang='ts>
import {
  Auth0Context,
  Auth0LoginButton,
  Auth0LogoutButton,
  authError,
  authToken,
  idToken,
  isAuthenticated,
  isLoading, 
  login,
  logout,
  userInfo,
} from '@dopry/svelte-auth0';

</script>
<Auth0Context 
domain="***********"
client_id="*********"
audience="*********'
callback_url="********"
logout_url="*********'
>
  <Auth0LoginButton class="text-white bg-black">Login</Auth0LoginButton>
  <Auth0LogoutButton class="text-white bg-black">Logout</Auth0LogoutButton>
  <pre>isLoading: {$isLoading}</pre>
  <pre>isAuthenticated: {$isAuthenticated}</pre>
  <pre>authToken: {$authToken}</pre>
  <pre>idToken: {$idToken}</pre>
  <pre>userInfo: {JSON.stringify($userInfo, null, 2)}</pre>
  <pre>authError: {$authError}</pre>
</Auth0Context>

Error:

  at Auth0Context.svelte:37:23
  at Object.$$render (/node_modules/svelte/internal/index.mjs:1876:22)
  at eval (/src/routes/+page.svelte:132:97)
  at Object.$$render (/node_modules/svelte/internal/index.mjs:1876:22)
  at Object.default (root.svelte:41:38)
  at eval (/src/routes/+layout.svelte:21:77)
  at Object.$$render (/node_modules/svelte/internal/index.mjs:1876:22)
  at root.svelte:40:37
  at $$render (/node_modules/svelte/internal/index.mjs:1876:22)
  at Object.render (/node_modules/svelte/internal/index.mjs:1884:26)
@dopry
Copy link
Owner

dopry commented Apr 16, 2023

Is this render SSR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants