[GH-ISSUE #1178] RevokeSession and RevokeOtherSessions don't working from API. #25953

Closed
opened 2026-04-17 16:17:01 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @binhodev on GitHub (Jan 10, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/1178

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

const revokeSession = await auth.api.revokeSession({
                headers: new Headers(c.req.header()),
                body: { token: session.session.token },
            });

Or

const revokeAllSessions = await auth.api.revokeOtherSessions({
                headers: new Headers(c.req.header()),
            });

Any method returned true, but session in database don't removed.

Current vs. Expected behavior

It should work, removing the sessions corresponding to the designated role from the database.

What version of Better Auth are you using?

1.1.10

Provide environment information

Windows 11 
Chrome

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

Backend

Auth config (if applicable)

No response

Additional context

No response

Originally created by @binhodev on GitHub (Jan 10, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/1178 ### Is this suited for github? - [X] Yes, this is suited for github ### To Reproduce ```typescript const revokeSession = await auth.api.revokeSession({ headers: new Headers(c.req.header()), body: { token: session.session.token }, }); ``` Or ```typescript const revokeAllSessions = await auth.api.revokeOtherSessions({ headers: new Headers(c.req.header()), }); ``` Any method returned true, but session in database don't removed. ### Current vs. Expected behavior It should work, removing the sessions corresponding to the designated role from the database. ### What version of Better Auth are you using? 1.1.10 ### Provide environment information ```bash Windows 11 Chrome ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) _No response_ ### Additional context _No response_
GiteaMirror added the lockedbug labels 2026-04-17 16:17:01 -05:00
Author
Owner

@joncrangle commented on GitHub (Feb 3, 2025):

This works for me to revoke a session from the server:

await auth.api.revokeSession({
	headers: new Headers({ "Content-Type": "application/json" }),
	body: { token: session.session.token },
});
<!-- gh-comment-id:2631453664 --> @joncrangle commented on GitHub (Feb 3, 2025): This works for me to revoke a session from the server: ```typescript await auth.api.revokeSession({ headers: new Headers({ "Content-Type": "application/json" }), body: { token: session.session.token }, }); ```
Author
Owner

@linhtrinh18 commented on GitHub (Apr 2, 2025):

Same here, it do not revoke the session and remove the seesion out of database

fetch("http://localhost:3045/api/auth/revoke-session", {
  "headers": {
    "content-type": "application/json",
    "sec-ch-ua": "\"Chromium\";v=\"134\", \"Not:A-Brand\";v=\"24\", \"Google Chrome\";v=\"134\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"macOS\""
  },
  "referrer": "http://localhost:3045/settings",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "{\"token\":\"U8PcoScgHwW6F2nAhOsX03fWEsiwjeRl\"}",
  "method": "POST",
  "mode": "cors",
  "credentials": "omit"
});

The response:
{"status":true}

But nothing change in the session list, the revoke session still there, and nothing removed from database.

Any idea why it not working?

<!-- gh-comment-id:2773251697 --> @linhtrinh18 commented on GitHub (Apr 2, 2025): Same here, it do not revoke the session and remove the seesion out of database ``` fetch("http://localhost:3045/api/auth/revoke-session", { "headers": { "content-type": "application/json", "sec-ch-ua": "\"Chromium\";v=\"134\", \"Not:A-Brand\";v=\"24\", \"Google Chrome\";v=\"134\"", "sec-ch-ua-mobile": "?0", "sec-ch-ua-platform": "\"macOS\"" }, "referrer": "http://localhost:3045/settings", "referrerPolicy": "strict-origin-when-cross-origin", "body": "{\"token\":\"U8PcoScgHwW6F2nAhOsX03fWEsiwjeRl\"}", "method": "POST", "mode": "cors", "credentials": "omit" }); ``` The response: {"status":true} But nothing change in the session list, the revoke session still there, and nothing removed from database. Any idea why it not working?
Author
Owner

@dosubot[bot] commented on GitHub (Jul 2, 2025):

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

Issue Summary

  • The issue involves revokeSession and revokeOtherSessions API methods in Better Auth version 1.1.10.
  • These methods return a success status but do not remove sessions from the database.
  • The issue occurs in a Windows 11 environment using Chrome.
  • @joncrangle shared a working code snippet, while @linhtrinh18 confirmed the issue with a detailed example.

Next Steps

  • Please confirm if this issue is still relevant to the latest version of the better-auth repository by commenting here.
  • If there is no response, the issue will be automatically closed in 7 days.

Thank you for your understanding and contribution!

<!-- gh-comment-id:3028421583 --> @dosubot[bot] commented on GitHub (Jul 2, 2025): Hi, @binhodev. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog. I'm marking this issue as stale. **Issue Summary** - The issue involves `revokeSession` and `revokeOtherSessions` API methods in Better Auth version 1.1.10. - These methods return a success status but do not remove sessions from the database. - The issue occurs in a Windows 11 environment using Chrome. - @joncrangle shared a working code snippet, while @linhtrinh18 confirmed the issue with a detailed example. **Next Steps** - Please confirm if this issue is still relevant to the latest version of the better-auth repository by commenting here. - If there is no response, the issue will be automatically closed in 7 days. Thank you for your understanding and contribution!
Author
Owner

@jefflang80 commented on GitHub (Sep 9, 2025):

I'm encountering this same issue on the latest better-auth package

<!-- gh-comment-id:3272058534 --> @jefflang80 commented on GitHub (Sep 9, 2025): I'm encountering this same issue on the latest better-auth package
Author
Owner

@vilgeforc5 commented on GitHub (Dec 17, 2025):

In my case, the revokeOtherSessions works fine, but revokeSession returns {status: true} , but no session is revoked. Latest package version

<!-- gh-comment-id:3667247756 --> @vilgeforc5 commented on GitHub (Dec 17, 2025): In my case, the `revokeOtherSessions` works fine, but `revokeSession` returns {status: true} , but no session is revoked. Latest package version
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#25953