state isn't updated on signout nuxt/vue #1268

Closed
opened 2026-03-13 08:30:42 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @renshoenen on GitHub (May 25, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

When singing out, the state with session and user isn't cleared:

const { data } = await auth.useSession(useFetch);
async onSignout() {
    console.dir(data.value);
        await auth.signOut({ fetchOptions: {
            onSuccess: () => {
                console.dir(data.value);
            },
        }
    });
    console.dir(data.value);
}

when calling onSingout(), all console logs still show the session and user. While logical for the first console.dir(), I expect this to be cleared by the signout for the second and third console.dir().

Current vs. Expected behavior

Considering there's a specific authClient for nuxt/vue via 'better-auth/vue' I expect the state to also be updated on singout.

What version of Better Auth are you using?

1.2.8

Provide environment information

- Operating System: Linux
- Node Version:     v22.3.0
- Nuxt Version:     3.17.3
- CLI Version:      3.25.1
- Nitro Version:    2.11.12
- Package Manager:  pnpm@9.15.4
- Builder:          -
- User Config:      compatibilityDate, devtools, vite, modules, eslint, future, css
- Runtime Modules:  @nuxt/eslint@1.3.0, @nuxt/ui@3.1.2, nuxt-svgo@4.1.0
- Build Modules:    -

Which area(s) are affected? (Select all that apply)

Client

Auth config (if applicable)

import { PrismaClient } from '@@/prismaClient';
import { betterAuth } from 'better-auth';
import { prismaAdapter } from 'better-auth/adapters/prisma';
import { openAPI } from 'better-auth/plugins';

const prisma = new PrismaClient({});

export const auth = betterAuth({
  database: prismaAdapter(prisma, {
    provider: 'sqlite', // or "mysql", "postgresql", ...etc
  }),
  emailAndPassword: {
    requireEmailVerification: true,
    enabled: true,
  },
  plugins: [
    openAPI(),
  ],
}

Additional context

No response

Originally created by @renshoenen on GitHub (May 25, 2025). ### Is this suited for github? - [ ] Yes, this is suited for github ### To Reproduce When singing out, the state with session and user isn't cleared: ```js const { data } = await auth.useSession(useFetch); async onSignout() { console.dir(data.value); await auth.signOut({ fetchOptions: { onSuccess: () => { console.dir(data.value); }, } }); console.dir(data.value); } ``` when calling onSingout(), all console logs still show the session and user. While logical for the first console.dir(), I expect this to be cleared by the signout for the second and third console.dir(). ### Current vs. Expected behavior Considering there's a specific authClient for nuxt/vue via 'better-auth/vue' I expect the state to also be updated on singout. ### What version of Better Auth are you using? 1.2.8 ### Provide environment information ```bash - Operating System: Linux - Node Version: v22.3.0 - Nuxt Version: 3.17.3 - CLI Version: 3.25.1 - Nitro Version: 2.11.12 - Package Manager: pnpm@9.15.4 - Builder: - - User Config: compatibilityDate, devtools, vite, modules, eslint, future, css - Runtime Modules: @nuxt/eslint@1.3.0, @nuxt/ui@3.1.2, nuxt-svgo@4.1.0 - Build Modules: - ``` ### Which area(s) are affected? (Select all that apply) Client ### Auth config (if applicable) ```typescript import { PrismaClient } from '@@/prismaClient'; import { betterAuth } from 'better-auth'; import { prismaAdapter } from 'better-auth/adapters/prisma'; import { openAPI } from 'better-auth/plugins'; const prisma = new PrismaClient({}); export const auth = betterAuth({ database: prismaAdapter(prisma, { provider: 'sqlite', // or "mysql", "postgresql", ...etc }), emailAndPassword: { requireEmailVerification: true, enabled: true, }, plugins: [ openAPI(), ], } ``` ### Additional context _No response_
Author
Owner

@dosubot[bot] commented on GitHub (Aug 24, 2025):

Hi, @Racusthor. I'm Dosu, and I'm helping the better-auth team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported that in a Nuxt 3.17.3 app using better-auth v1.2.8, signing out does not clear the session and user state as expected.
  • After signout, session data remains visible in console logs, and the authClient state does not update.
  • No further comments or activity have been recorded on this issue.

Next Steps:

  • Please let me know if this issue is still relevant with the latest version of better-auth by commenting here.
  • If I don’t hear back within 7 days, this issue will be automatically closed.

Thanks for your understanding and contribution!

@dosubot[bot] commented on GitHub (Aug 24, 2025): Hi, @Racusthor. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported that in a Nuxt 3.17.3 app using better-auth v1.2.8, signing out does not clear the session and user state as expected. - After signout, session data remains visible in console logs, and the authClient state does not update. - No further comments or activity have been recorded on this issue. **Next Steps:** - Please let me know if this issue is still relevant with the latest version of better-auth by commenting here. - If I don’t hear back within 7 days, this issue will be automatically closed. Thanks for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1268