[PR #7669] [MERGED] feat(oauth-provider): add iss parameter to authorization responses (RFC 9207) #7482

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7669
Author: @Paola3stefania
Created: 1/29/2026
Status: Merged
Merged: 1/29/2026
Merged by: @Bekacru

Base: canaryHead: feat/oauth-provider-rfc9207-iss


📝 Commits (3)

📊 Changes

11 files changed (+706 additions, -4 deletions)

View changed files

📝 docs/content/docs/plugins/generic-oauth.mdx (+69 -0)
📝 docs/content/docs/plugins/oauth-provider.mdx (+2 -0)
📝 packages/better-auth/src/plugins/generic-oauth/error-codes.ts (+4 -0)
📝 packages/better-auth/src/plugins/generic-oauth/generic-oauth.test.ts (+381 -0)
📝 packages/better-auth/src/plugins/generic-oauth/routes.ts (+30 -0)
📝 packages/better-auth/src/plugins/generic-oauth/types.ts (+14 -0)
📝 packages/oauth-provider/src/authorize.test.ts (+135 -1)
📝 packages/oauth-provider/src/authorize.ts (+58 -1)
📝 packages/oauth-provider/src/consent.ts (+2 -1)
📝 packages/oauth-provider/src/metadata.ts (+3 -1)
📝 packages/oauth-provider/src/types/oauth.ts (+8 -0)

📄 Description

Summary by cubic

Adds RFC 9207 issuer support to prevent OAuth mix-up attacks. Authorization responses now include iss, and Generic OAuth callbacks validate it (auto-discovered or configured) with an optional strict mode.

  • New Features
    • OAuth Provider: adds iss to success and error redirects; exposes authorization_response_iss_parameter_supported in metadata; derives issuer from JWT plugin issuer or baseURL; sanitizes issuer (validateIssuerUrl).
    • Generic OAuth: new config options issuer and requireIssuerValidation; auto-discovers issuer from discoveryUrl; validates iss in callbacks; adds issuer_mismatch and issuer_missing errors; accepts iss in callback schema; docs updated with examples and guidance.
    • Tests: extensive coverage for issuer validation, redirects, and metadata.

Written for commit ccdd3662fd. Summary will update 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/7669 **Author:** [@Paola3stefania](https://github.com/Paola3stefania) **Created:** 1/29/2026 **Status:** ✅ Merged **Merged:** 1/29/2026 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `feat/oauth-provider-rfc9207-iss` --- ### 📝 Commits (3) - [`b516ee4`](https://github.com/better-auth/better-auth/commit/b516ee4df3ae33b11058001bd5057c1b80a15a0b) feat iss - [`36d1de0`](https://github.com/better-auth/better-auth/commit/36d1de06c98b2f6e1e81285dc1bfffbca50d1a32) docs and client side - [`ccdd366`](https://github.com/better-auth/better-auth/commit/ccdd3662fd8f3dde9057a81fb44ffbcfb792bef5) make lint happy ### 📊 Changes **11 files changed** (+706 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/generic-oauth.mdx` (+69 -0) 📝 `docs/content/docs/plugins/oauth-provider.mdx` (+2 -0) 📝 `packages/better-auth/src/plugins/generic-oauth/error-codes.ts` (+4 -0) 📝 `packages/better-auth/src/plugins/generic-oauth/generic-oauth.test.ts` (+381 -0) 📝 `packages/better-auth/src/plugins/generic-oauth/routes.ts` (+30 -0) 📝 `packages/better-auth/src/plugins/generic-oauth/types.ts` (+14 -0) 📝 `packages/oauth-provider/src/authorize.test.ts` (+135 -1) 📝 `packages/oauth-provider/src/authorize.ts` (+58 -1) 📝 `packages/oauth-provider/src/consent.ts` (+2 -1) 📝 `packages/oauth-provider/src/metadata.ts` (+3 -1) 📝 `packages/oauth-provider/src/types/oauth.ts` (+8 -0) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Adds RFC 9207 issuer support to prevent OAuth mix-up attacks. Authorization responses now include iss, and Generic OAuth callbacks validate it (auto-discovered or configured) with an optional strict mode. - New Features - OAuth Provider: adds iss to success and error redirects; exposes authorization_response_iss_parameter_supported in metadata; derives issuer from JWT plugin issuer or baseURL; sanitizes issuer (validateIssuerUrl). - Generic OAuth: new config options issuer and requireIssuerValidation; auto-discovers issuer from discoveryUrl; validates iss in callbacks; adds issuer_mismatch and issuer_missing errors; accepts iss in callback schema; docs updated with examples and guidance. - Tests: extensive coverage for issuer validation, redirects, and metadata. <sup>Written for commit ccdd3662fd8f3dde9057a81fb44ffbcfb792bef5. Summary will update 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:38: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#7482