[PR #6614] [MERGED] chore: add nonce check and verifying jwt claims for google #6779

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6614
Author: @jonathansamines
Created: 12/8/2025
Status: Merged
Merged: 12/8/2025
Merged by: @Bekacru

Base: canaryHead: feat/verify-google-jwt


📝 Commits (1)

  • 46be831 feat(better-auth): verify google jwt claims

📊 Changes

1 file changed (+46 additions, -17 deletions)

View changed files

📝 packages/core/src/social-providers/google.ts (+46 -17)

📄 Description

Closes https://github.com/better-auth/better-auth/issues/6521

Summary by cubic

Verifies Google ID tokens by checking JWT signatures and claims against Google’s JWKs, replacing the tokeninfo lookup. Improves security and correctness of Google auth.

  • New Features
    • Added getGooglePublicKey to fetch/import JWKs and verify tokens with jose.
    • Enforced issuer, audience (clientId), nonce match, and a 1h max token age.
    • Returns false on invalid headers or nonce mismatch; throws APIError if keys are missing.
    • Still supports a custom options.verifyIdToken override.

Written for commit 46be831212. Summary will update automatically 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/6614 **Author:** [@jonathansamines](https://github.com/jonathansamines) **Created:** 12/8/2025 **Status:** ✅ Merged **Merged:** 12/8/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `feat/verify-google-jwt` --- ### 📝 Commits (1) - [`46be831`](https://github.com/better-auth/better-auth/commit/46be831212ab3ebe507f12f150a07ebc126ead36) feat(better-auth): verify google jwt claims ### 📊 Changes **1 file changed** (+46 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `packages/core/src/social-providers/google.ts` (+46 -17) </details> ### 📄 Description Closes https://github.com/better-auth/better-auth/issues/6521 <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Verifies Google ID tokens by checking JWT signatures and claims against Google’s JWKs, replacing the tokeninfo lookup. Improves security and correctness of Google auth. - **New Features** - Added getGooglePublicKey to fetch/import JWKs and verify tokens with jose. - Enforced issuer, audience (clientId), nonce match, and a 1h max token age. - Returns false on invalid headers or nonce mismatch; throws APIError if keys are missing. - Still supports a custom options.verifyIdToken override. <sup>Written for commit 46be831212ab3ebe507f12f150a07ebc126ead36. Summary will update automatically 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 13:11:27 -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#6779