[PR #6037] [CLOSED] fix(siwe): set lastLoginMethod when signing in with SIWE #6399

Closed
opened 2026-03-13 12:57:32 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6037
Author: @MuzzaiyyanHussain
Created: 11/17/2025
Status: Closed

Base: canaryHead: fix/siwe-last-login-method


📝 Commits (5)

  • 8c2bcfe fix(siwe): update lastLoginMethod on SIWE login
  • 1759c4e fix(siwe): update lastLoginMethod on successful SIWE login and add test
  • 59d1910 Merge branch 'canary' into fix/siwe-last-login-method
  • 8f87bb1 Merge branch 'canary' into fix/siwe-last-login-method
  • dd8b2c6 fix(siwe): use APIError and remove unnecessary null assertions

📊 Changes

3 files changed (+70 additions, -22 deletions)

View changed files

📝 packages/better-auth/src/plugins/siwe/index.ts (+20 -22)
📝 packages/better-auth/src/plugins/siwe/schema.ts (+9 -0)
📝 packages/better-auth/src/plugins/siwe/siwe.test.ts (+41 -0)

📄 Description

Summary

This PR fixes an issue where lastLoginMethod was not being updated when a user signs in using SIWE (Sign-In With Ethereum). Other authentication providers correctly update this field, but the SIWE flow did not, causing inconsistent behavior for plugins and audit logs that rely on it.

Fixes

  • After creating or finding the user in the /siwe/verify handler, the SIWE plugin now updates:
    lastLoginMethod: "siwe"
    
  • No other logic or structure was modified; this change is minimal and isolated.

Fixes #6022


Summary by cubic

Updated SIWE sign-in to set lastLoginMethod to "siwe", so plugins and audit logs correctly reflect the login method. No other logic changed.

Written for commit dd8b2c6ba7. 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/6037 **Author:** [@MuzzaiyyanHussain](https://github.com/MuzzaiyyanHussain) **Created:** 11/17/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `fix/siwe-last-login-method` --- ### 📝 Commits (5) - [`8c2bcfe`](https://github.com/better-auth/better-auth/commit/8c2bcfefdb2a19d307471643e0272f986c16d901) fix(siwe): update lastLoginMethod on SIWE login - [`1759c4e`](https://github.com/better-auth/better-auth/commit/1759c4e4a713f6c1aaa770b277677186d17e6893) fix(siwe): update lastLoginMethod on successful SIWE login and add test - [`59d1910`](https://github.com/better-auth/better-auth/commit/59d19101c4597ee95d772d0b54e9dc042615a122) Merge branch 'canary' into fix/siwe-last-login-method - [`8f87bb1`](https://github.com/better-auth/better-auth/commit/8f87bb16507a42873f20895fe5f8852c0881e0ca) Merge branch 'canary' into fix/siwe-last-login-method - [`dd8b2c6`](https://github.com/better-auth/better-auth/commit/dd8b2c6ba7c1f14a2f4e7124cea167a6a3a838f3) fix(siwe): use APIError and remove unnecessary null assertions ### 📊 Changes **3 files changed** (+70 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/siwe/index.ts` (+20 -22) 📝 `packages/better-auth/src/plugins/siwe/schema.ts` (+9 -0) 📝 `packages/better-auth/src/plugins/siwe/siwe.test.ts` (+41 -0) </details> ### 📄 Description ## Summary This PR fixes an issue where `lastLoginMethod` was not being updated when a user signs in using SIWE (Sign-In With Ethereum). Other authentication providers correctly update this field, but the SIWE flow did not, causing inconsistent behavior for plugins and audit logs that rely on it. ## Fixes - After creating or finding the user in the `/siwe/verify` handler, the SIWE plugin now updates: ```ts lastLoginMethod: "siwe" ``` - No other logic or structure was modified; this change is minimal and isolated. ## Related Issue Fixes #6022 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Updated SIWE sign-in to set lastLoginMethod to "siwe", so plugins and audit logs correctly reflect the login method. No other logic changed. <sup>Written for commit dd8b2c6ba7c1f14a2f4e7124cea167a6a3a838f3. 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 12:57:32 -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#6399