# Auth0-nuxt and access to the user data in callback

**URL:** <https://community.auth0.com/t/auth0-nuxt-and-access-to-the-user-data-in-callback/196759>\
**Category:** Get Help\
**Tags:** authentication-sessions, sessions\
**Created:** [January 30, 2026, 2:41pm UTC](https://community.auth0.com/t/auth0-nuxt-and-access-to-the-user-data-in-callback/196759 "2026-01-30T14:41:33Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![remus.ivan](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/remus.ivan/32/68771_2.png) [@remus.ivan](https://community.auth0.com/u/remus.ivan)\
**Post date:** [January 30, 2026, 4:40pm UTC](https://community.auth0.com/t/auth0-nuxt-and-access-to-the-user-data-in-callback/196759/3 "2026-01-30T16:40:07Z")

</div>

Hi @aleksandra,

Welcome to the Auth0 Community!

The issue should be caused by your attempt to read the user state from the `getUser()` request, which has not yet set the session cookie in order for your server-side handlers to read it, resulting an _undefined_ user object.

You can try verifying the returned object of your `completeInteractiveLogin` function which you should be able to use immediately instead of relying on cookies. The code should look something like this:

```auto
// server/routes/auth/callback.ts
export default defineEventHandler(async (event) => {
  const auth0Client = useAuth0(event);
  const auth0ClientOptions = event.context.auth0ClientOptions;

  const result = await auth0Client.completeInteractiveLogin(
    new URL(event.node.req.url ?? ", auth0ClientOptions.appBaseUrl)
  );

  const user = result.user || result.session?.user; 

  const { appState } = result;

  if (user) {
    const config = useRuntimeConfig();
    try {
      await $fetch(config.myApiUrl, { 
        method: 'post',
        body: {
          id: String(user.sub),
          email: String(user.email),
        },
      });
    } catch (error) {
      console.error('API Side-effect failed', error);
    }
  }

  return sendRedirect(event, appState?.returnTo ?? '/');
});

```

Alternatively, you can try **decoding the ID token** returned by the completeInteractiveLogin function:

```auto
import { jwtDecode } from "jwt-decode";

const result = await auth0Client.completeInteractiveLogin(...);

if (result.idToken) {
    const claims = jwtDecode(result.idToken);
    const userId = claims.sub;
    const email = claims.email;
    // proceed with the API call
}

```

I hope this helps and if you have further questions please let me know!  
Best regards,  
Remus

---

_[View the full topic](https://community.auth0.com/t/auth0-nuxt-and-access-to-the-user-data-in-callback/196759)._
