[PR #1161] [MERGED] Fix JWT private key import by explicitly specifying algorithm #3661

Closed
opened 2026-03-13 11:03:39 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/1161
Author: @9j
Created: 1/9/2025
Status: Merged
Merged: 1/9/2025
Merged by: @Bekacru

Base: mainHead: patch-1


📝 Commits (1)

  • 71902fb fix(jwt): add required alg parameter to importJWK

📊 Changes

1 file changed (+4 additions, -1 deletions)

View changed files

📝 packages/better-auth/src/plugins/jwt/index.ts (+4 -1)

📄 Description

fix: add missing algorithm parameter in importJWK function

  • Add explicit algorithm parameter when importing private key using importJWK
  • Resolve "'alg' argument is required when 'jwk.alg' is not present" error in Bun environment
  • Default to 'EdDSA' if no algorithm is specified in keyPairConfig

This change ensures compatibility with stricter JWT implementations and fixes
the token generation process in Bun runtime.


🔄 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/1161 **Author:** [@9j](https://github.com/9j) **Created:** 1/9/2025 **Status:** ✅ Merged **Merged:** 1/9/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `patch-1` --- ### 📝 Commits (1) - [`71902fb`](https://github.com/better-auth/better-auth/commit/71902fbcdc605b6d40e18a4867dc863f2ceff6c4) fix(jwt): add required alg parameter to importJWK ### 📊 Changes **1 file changed** (+4 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/jwt/index.ts` (+4 -1) </details> ### 📄 Description fix: add missing algorithm parameter in importJWK function - Add explicit algorithm parameter when importing private key using importJWK - Resolve "'alg' argument is required when 'jwk.alg' is not present" error in Bun environment - Default to 'EdDSA' if no algorithm is specified in keyPairConfig This change ensures compatibility with stricter JWT implementations and fixes the token generation process in Bun runtime. --- <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 11:03:39 -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#3661