[PR #8140] fix(last-login-method): avoid store cookie when storeInDatabase is true #7774

Open
opened 2026-03-13 13:48:47 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8140
Author: @simonfelding
Created: 2/25/2026
Status: 🔄 Open

Base: canaryHead: last-login-method-gdpr-compliance


📝 Commits (3)

📊 Changes

3 files changed (+130 additions, -35 deletions)

View changed files

📝 docs/content/docs/plugins/last-login-method.mdx (+17 -16)
📝 packages/better-auth/src/plugins/last-login-method/index.ts (+1 -0)
📝 packages/better-auth/src/plugins/last-login-method/last-login-method.test.ts (+112 -19)

📄 Description

This is more as the user would expect - storeInDatabase should not both set a cookie and a database key.

The advantage of this is that it redundant, and that it enables EU cookie law compliance, by not storing functionally unnecessary cookies.

I also wrote tests - i think this fix is quite elegant and simple.

Fixes #5727 #5753


Summary by cubic

Change last-login-method to not set the last_used_login_method cookie when storeInDatabase is true. This removes redundant storage and supports GDPR/EU cookie compliance; tests and docs updated for both DB-only and default cookie modes.

Written for commit 05e537387f. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/8140 **Author:** [@simonfelding](https://github.com/simonfelding) **Created:** 2/25/2026 **Status:** 🔄 Open **Base:** `canary` ← **Head:** `last-login-method-gdpr-compliance` --- ### 📝 Commits (3) - [`d3c4d0e`](https://github.com/better-auth/better-auth/commit/d3c4d0e5dc4c4c3d08772505d07db49c97055ae6) a start - [`8b18444`](https://github.com/better-auth/better-auth/commit/8b1844455719525ffbbd4fe7166086d6cbc95847) better tests - [`05e5373`](https://github.com/better-auth/better-auth/commit/05e537387fca99581e77188f490a9b68c32cead9) update docs ### 📊 Changes **3 files changed** (+130 additions, -35 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/last-login-method.mdx` (+17 -16) 📝 `packages/better-auth/src/plugins/last-login-method/index.ts` (+1 -0) 📝 `packages/better-auth/src/plugins/last-login-method/last-login-method.test.ts` (+112 -19) </details> ### 📄 Description This is more as the user would expect - storeInDatabase should not both set a cookie and a database key. The advantage of this is that it redundant, and that it enables EU cookie law compliance, by not storing functionally unnecessary cookies. I also wrote tests - i think this fix is quite elegant and simple. Fixes #5727 #5753 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Change last-login-method to not set the last_used_login_method cookie when storeInDatabase is true. This removes redundant storage and supports GDPR/EU cookie compliance; tests and docs updated for both DB-only and default cookie modes. <sup>Written for commit 05e537387fca99581e77188f490a9b68c32cead9. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 13:48:47 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#7774