[GH-ISSUE #5309] Calling auth.api.updateApiKey sets lastRequest #27533

Closed
opened 2026-04-17 18:35:38 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @lensbart on GitHub (Oct 14, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/5309

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Hello,

My understanding would be that lastRequest returns the timestamp of the last API call that uses the API to authenticate. However, when calling auth.api.updateApiKey for an API key with lastRequest: null, the lastRequest value will be set to the current timestamp.

Current vs. Expected behavior

lastRequest is not modified when the API key is updated (e.g. renamed)

What version of Better Auth are you using?

1.3.27

System info

📊 Better Auth System Information

==================================================

🖥️  System Information:
  platform: darwin
  arch: arm64
  version: Darwin Kernel Version 25.0.0: Wed Sep 17 21:38:50 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T6031
  release: 25.0.0
  cpuCount: 16
  cpuModel: Apple M3 Max
  totalMemory: 64.00 GB
  freeMemory: 33.10 GB

📦 Node.js:
  version: v24.9.0
  env: development

📦 Package Manager:
  name: npm
  version: 11.6.0

🚀 Frameworks:
  name: react
  version: ^19.2.0

💾 Database Clients:
  name: pg
  version: ^8.16.3
  name: drizzle
  version: ^0.44.6

🔐 Better Auth:
  Version: ^1.3.27

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

Backend

Auth config (if applicable)


Additional context

No response

Originally created by @lensbart on GitHub (Oct 14, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/5309 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce Hello, My understanding would be that `lastRequest` returns the timestamp of the last API call that uses the API to authenticate. However, when calling `auth.api.updateApiKey` for an API key with `lastRequest: null`, the `lastRequest` value will be set to the current timestamp. ### Current vs. Expected behavior `lastRequest` is not modified when the API key is updated (e.g. renamed) ### What version of Better Auth are you using? 1.3.27 ### System info ```bash 📊 Better Auth System Information ================================================== 🖥️ System Information: platform: darwin arch: arm64 version: Darwin Kernel Version 25.0.0: Wed Sep 17 21:38:50 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T6031 release: 25.0.0 cpuCount: 16 cpuModel: Apple M3 Max totalMemory: 64.00 GB freeMemory: 33.10 GB 📦 Node.js: version: v24.9.0 env: development 📦 Package Manager: name: npm version: 11.6.0 🚀 Frameworks: name: react version: ^19.2.0 💾 Database Clients: name: pg version: ^8.16.3 name: drizzle version: ^0.44.6 🔐 Better Auth: Version: ^1.3.27 ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript ``` ### Additional context _No response_
GiteaMirror added the lockedbug labels 2026-04-17 18:35:38 -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#27533