[PR #5064] [CLOSED] fix(api-key): shouldn't generate a session for API key by default #5751

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5064
Author: @Bekacru
Created: 10/3/2025
Status: Closed

Base: canaryHead: fix/api-keys


📝 Commits (10+)

  • d1fe109 Revert "chore: bump tailwindcss to v4 (#4681)"
  • 1e86e4c refactor: remove unused generics (#4691)
  • 62b5069 fix(api-key): cascade api keys on user deletion (#4703)
  • 578a64e fix: device authorization plugin (#4695)
  • adfc484 fix(organization): decouple client and server permission checks (#4707)
  • fd29b5b fix: reduce any type in generator.ts (#4710)
  • bb5513d Reapply "chore: bump tailwindcss to v4 (#4681)"
  • c335407 fix: refresh secondary storage sessions on user update (#4522)
  • c6e5dab fix(adapter): returning null as string for optional id references (#4713)
  • 3ec47de chore(demo): fix globals.css (#4725)

📊 Changes

364 files changed (+16450 additions, -5043 deletions)

View changed files

📝 .github/workflows/ci.yml (+1 -1)
📝 .github/workflows/e2e.yml (+4 -3)
📝 .github/workflows/preview.yml (+1 -1)
📝 .github/workflows/release.yml (+11 -6)
📝 biome.json (+4 -2)
demo/expo-example/.env.example (+7 -0)
demo/expo-example/.gitignore (+20 -0)
demo/expo-example/README.md (+15 -0)
demo/expo-example/app.config.ts (+55 -0)
demo/expo-example/assets/bg-image.jpeg (+0 -0)
demo/expo-example/assets/fonts/SpaceMono-Regular.ttf (+0 -0)
demo/expo-example/assets/icon.png (+0 -0)
demo/expo-example/assets/images/adaptive-icon.png (+0 -0)
demo/expo-example/assets/images/favicon.png (+0 -0)
demo/expo-example/assets/images/logo.png (+0 -0)
demo/expo-example/assets/images/partial-react-logo.png (+0 -0)
demo/expo-example/assets/images/react-logo.png (+0 -0)
demo/expo-example/assets/images/react-logo@2x.png (+0 -0)
demo/expo-example/assets/images/react-logo@3x.png (+0 -0)
demo/expo-example/assets/images/splash.png (+0 -0)

...and 80 more files

📄 Description

Summary by cubic

Stop creating sessions from API keys by default. Introduces an explicit enableSessionForAPIKeys flag to opt in, and updates docs with guidance and warnings.

  • Bug Fixes

    • API keys no longer auto-generate mock sessions unless enableSessionForAPIKeys is true.
    • Renamed option: disableSessionForAPIKeys -> enableSessionForAPIKeys.
    • Updated types, routes, and docs; added a security warning and usage example.
  • Migration

    • If you relied on the old behavior, set enableSessionForAPIKeys: true in the apiKey plugin config.
    • Replace any usage of disableSessionForAPIKeys with enableSessionForAPIKeys.

🔄 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/5064 **Author:** [@Bekacru](https://github.com/Bekacru) **Created:** 10/3/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `fix/api-keys` --- ### 📝 Commits (10+) - [`d1fe109`](https://github.com/better-auth/better-auth/commit/d1fe10962079c82920ea078a9847f65a59907b81) Revert "chore: bump tailwindcss to v4 (#4681)" - [`1e86e4c`](https://github.com/better-auth/better-auth/commit/1e86e4c138235fe6539e2795d0fd8a9f511b4716) refactor: remove unused generics (#4691) - [`62b5069`](https://github.com/better-auth/better-auth/commit/62b50691b1db7396241aaacf6a6501c09c97e1b6) fix(api-key): cascade api keys on user deletion (#4703) - [`578a64e`](https://github.com/better-auth/better-auth/commit/578a64eb965da77254c14a676128812df4646d83) fix: device authorization plugin (#4695) - [`adfc484`](https://github.com/better-auth/better-auth/commit/adfc484fcd9dce4976a649795a7915bcd9f116a0) fix(organization): decouple client and server permission checks (#4707) - [`fd29b5b`](https://github.com/better-auth/better-auth/commit/fd29b5bd19f3dd8ee46c7615a5a581efc18fe1cc) fix: reduce any type in generator.ts (#4710) - [`bb5513d`](https://github.com/better-auth/better-auth/commit/bb5513d216b996206d9e21b21cdee20f4d98fd60) Reapply "chore: bump tailwindcss to v4 (#4681)" - [`c335407`](https://github.com/better-auth/better-auth/commit/c33540765860569a016574cb9e9cdc74f0ecfec5) fix: refresh secondary storage sessions on user update (#4522) - [`c6e5dab`](https://github.com/better-auth/better-auth/commit/c6e5dab8ab40386ac033e15e2695832105f66edf) fix(adapter): returning null as string for optional id references (#4713) - [`3ec47de`](https://github.com/better-auth/better-auth/commit/3ec47dedbd6f2c87f337a9fcbe93d70cc39d735d) chore(demo): fix globals.css (#4725) ### 📊 Changes **364 files changed** (+16450 additions, -5043 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/ci.yml` (+1 -1) 📝 `.github/workflows/e2e.yml` (+4 -3) 📝 `.github/workflows/preview.yml` (+1 -1) 📝 `.github/workflows/release.yml` (+11 -6) 📝 `biome.json` (+4 -2) ➕ `demo/expo-example/.env.example` (+7 -0) ➕ `demo/expo-example/.gitignore` (+20 -0) ➕ `demo/expo-example/README.md` (+15 -0) ➕ `demo/expo-example/app.config.ts` (+55 -0) ➕ `demo/expo-example/assets/bg-image.jpeg` (+0 -0) ➕ `demo/expo-example/assets/fonts/SpaceMono-Regular.ttf` (+0 -0) ➕ `demo/expo-example/assets/icon.png` (+0 -0) ➕ `demo/expo-example/assets/images/adaptive-icon.png` (+0 -0) ➕ `demo/expo-example/assets/images/favicon.png` (+0 -0) ➕ `demo/expo-example/assets/images/logo.png` (+0 -0) ➕ `demo/expo-example/assets/images/partial-react-logo.png` (+0 -0) ➕ `demo/expo-example/assets/images/react-logo.png` (+0 -0) ➕ `demo/expo-example/assets/images/react-logo@2x.png` (+0 -0) ➕ `demo/expo-example/assets/images/react-logo@3x.png` (+0 -0) ➕ `demo/expo-example/assets/images/splash.png` (+0 -0) _...and 80 more files_ </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Stop creating sessions from API keys by default. Introduces an explicit enableSessionForAPIKeys flag to opt in, and updates docs with guidance and warnings. - **Bug Fixes** - API keys no longer auto-generate mock sessions unless enableSessionForAPIKeys is true. - Renamed option: disableSessionForAPIKeys -> enableSessionForAPIKeys. - Updated types, routes, and docs; added a security warning and usage example. - **Migration** - If you relied on the old behavior, set enableSessionForAPIKeys: true in the apiKey plugin config. - Replace any usage of disableSessionForAPIKeys with enableSessionForAPIKeys. <!-- 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:34:19 -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#5751