Getting Auth0 working with Nuxt 3 SSR

I’ve trying for days now to get Auth0 working with Nuxt 3 SSR. The vue-sdk is not configured to work with SSR causing multiple errors due to looking at window or document. I’ve also had to use server routes to redirect users to login because we need to send a user to the login from our application without route flashes or loginWithRedirect.

If anyone has been able to get Auth0 working with Nuxt and SSR please let me know your approach because I’ve had zero luck.

Hi @scott.carlton

Welcome to the Auth0 Community!

I’m not a Nuxt expert, but while researching your question, I found that on the Nuxt roadmap, they don’t have a planned release for auth0 utils yet. However, they’ve provided the temporary repository → GitHub - atinux/nuxt-auth-utils: Add Authentication to Nuxt applications with secured & sealed cookies sessions., and it looks like it supports both SSR and Auth0. Did you have a chance to check this library?

Thanks
Dawid

Dawid,
Thanks for the reply. I had looked at that module but thought it might not meet our use case. We don’t use a click event on a button to trigger the loginWIthRedirect that auth0 implements.

In our case a user that goes to our /login or /o/:slug for organizations is redirected via a server/routes/login or server/routes/o/[slug] file that does the redirect to auth0’s login flow base on a url string using the clientId, auth0 domain and any other requirements for that flow. This all appears to be working as expected.

The primary issue is when the user is redirect to /callback it continues to fail with a 500 issue a soon as i implement any sdk method and I’ve not been able to solve it gracefully with event with import.meta.client.

Thought I saw the Nuxt SDK package has been in discussion and on the roadmap since mid 2023 and was suppose to be supported Q3 2024 but has been moved out to Q3 2025.