[PR #3655] [CLOSED] feat: expose verify id token on generic oauth #4938

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3655
Author: @ThallesP
Created: 7/27/2025
Status: Closed

Base: mainHead: feat/add-verify-id-token


📝 Commits (8)

  • d75dab3 expose verify id token
  • 3fe3af5 add docs
  • a121e1c Merge branch 'main' of github.com:better-auth/better-auth into feat/add-verify-id-token
  • fc0ae49 improve docs
  • acc0651 add a hint about jose
  • e78cc44 add docs on both client/server
  • b794e8f Merge branch 'main' into feat/add-verify-id-token
  • dcdbe43 Merge branch 'main' into feat/add-verify-id-token

📊 Changes

2 files changed (+62 additions, -0 deletions)

View changed files

📝 docs/content/docs/plugins/generic-oauth.mdx (+56 -0)
📝 packages/better-auth/src/plugins/generic-oauth/index.ts (+6 -0)

📄 Description

Recently, I had to integrate a generic OAuth2 system that uses identity tokens for validations (https://web3auth.io/docs/authentication/id-token). However, the generic OAuth options did not expose the verifyIdToken in the available options. This PR exposes this functionality so it can be passed.

Additionally, the support for identity tokens could be improved for generic OAuth. I am considering adding an option to accept a JWKS endpoint (instead of only accepting a discovery URL) and also an option to decode the token directly into the getUserInfo without requiring installation of a full JWT library. This would allow developers to input the necessary userInfo from the idToken's payload.

If this approach makes sense, please let me know so I can open another PR. For now, I wanted to implement something quickly as I need this functionality for my work.


Summary by cubic

Exposed a new verifyIdToken option in the generic OAuth plugin, allowing custom ID token verification for providers that return identity tokens.

  • New Features
    • Added verifyIdToken function to the GenericOAuthConfig interface.
    • Updated documentation with usage examples for verifying and decoding ID tokens.

🔄 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/3655 **Author:** [@ThallesP](https://github.com/ThallesP) **Created:** 7/27/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/add-verify-id-token` --- ### 📝 Commits (8) - [`d75dab3`](https://github.com/better-auth/better-auth/commit/d75dab383e022a52e665cc39e1d3712ace375813) expose verify id token - [`3fe3af5`](https://github.com/better-auth/better-auth/commit/3fe3af5a1d99dd59d3b4daecf9b7e98aa349fc2a) add docs - [`a121e1c`](https://github.com/better-auth/better-auth/commit/a121e1c8313a805aaad0acae6545dac40ab3216a) Merge branch 'main' of github.com:better-auth/better-auth into feat/add-verify-id-token - [`fc0ae49`](https://github.com/better-auth/better-auth/commit/fc0ae498a8c52871050251057b32a06b681b7770) improve docs - [`acc0651`](https://github.com/better-auth/better-auth/commit/acc065162354f15a052d2fb752c7a4ba0b1159e9) add a hint about jose - [`e78cc44`](https://github.com/better-auth/better-auth/commit/e78cc44221a12a7627c24ab7d9e9f28d284bbfeb) add docs on both client/server - [`b794e8f`](https://github.com/better-auth/better-auth/commit/b794e8f755be9ca3cf30fc8e584ee7848402ad2b) Merge branch 'main' into feat/add-verify-id-token - [`dcdbe43`](https://github.com/better-auth/better-auth/commit/dcdbe4372354f08043f0646dfb6d921e8b107c1a) Merge branch 'main' into feat/add-verify-id-token ### 📊 Changes **2 files changed** (+62 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/generic-oauth.mdx` (+56 -0) 📝 `packages/better-auth/src/plugins/generic-oauth/index.ts` (+6 -0) </details> ### 📄 Description Recently, I had to integrate a generic OAuth2 system that uses identity tokens for validations (https://web3auth.io/docs/authentication/id-token). However, the generic OAuth options did not expose the `verifyIdToken` in the available options. This PR exposes this functionality so it can be passed. Additionally, the support for identity tokens could be improved for generic OAuth. I am considering adding an option to accept a JWKS endpoint (instead of only accepting a discovery URL) and also an option to decode the token directly into the `getUserInfo` without requiring installation of a full JWT library. This would allow developers to input the necessary `userInfo` from the `idToken`'s payload. If this approach makes sense, please let me know so I can open another PR. For now, I wanted to implement something quickly as I need this functionality for my work. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Exposed a new verifyIdToken option in the generic OAuth plugin, allowing custom ID token verification for providers that return identity tokens. - **New Features** - Added verifyIdToken function to the GenericOAuthConfig interface. - Updated documentation with usage examples for verifying and decoding ID tokens. <!-- 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:04:50 -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#4938