Add FAPI 2.0 Security Profile Support + OAuth 2.1 #1476

Closed
opened 2026-03-13 08:42:16 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @tatarmb4s on GitHub (Jul 8, 2025).

Is this suited for github?

  • Yes, this is suited for github

I'm working on a financial application that needs to comply with FAPI 2.0 security requirements. While better-auth is great for standard and secure authentication flows, it currently lacks support for FAPI 2.0 specific features like mTLS/DPoP token binding and Pushed Authorization Requests (PAR). This makes it difficult to achieve the required security level for financial-grade applications.

Describe the solution you'd like

I'd like to see FAPI 2.0 support added to better-auth, specifically:

  1. Support for sender-constrained tokens through either mTLS or DPoP
  2. Implementation of Pushed Authorization Requests (PAR)
  3. Enhanced security features required by FAPI 2.0:
    • Enforced PKCE with S256
    • Private key JWT for client authentication
    • Support for stronger signing algorithms (PS256/ES256/EdDSA)
  4. Other core parts of FAPI 2.0 and OAuth 2.1

These could be implemented as a new @better-auth/fapi package or as an optional part of the core plugins system.

I summarized the core things of the technologies, you can see it in the md files.

https://www.perplexity.ai/page/bff-oauth2-1-fapi-2-0-OFgzsmqfRY2q8QI.xLv2OA
https://www.perplexity.ai/page/comprehensive-security-require-3SDrX4IxStaTDGwcNZYLfw

Offical sources:
https://oauth.net/fapi/
https://openid.net/specs/fapi-security-profile-2_0-final.html
https://openid.net/specs/fapi-attacker-model-2_0-final.html

https://oauth.net/2.1/

Describe alternatives you've considered

  1. Building custom plugins - Maybe Too complex and error-prone for security-critical features, I tbh didn't dig too much into the source code
  2. Using a separate auth server - Adds unnecessary infrastructure complexity and doesn't fulfill some of the security gaps
  3. Implementing at the web server level - Makes the security features less integrated and harder to maintain while still not fulfilling the security gaps

Additional context

I'm willing to contribute to this feature (and also to the feature request realetd to ABAC) if there's interest, because I have to use it, and doesn't matter what open source auth library I chose for NextJS I have to write it for myself currently, because no alternatives like this support it.

Originally created by @tatarmb4s on GitHub (Jul 8, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. I'm working on a financial application that needs to comply with FAPI 2.0 security requirements. While better-auth is great for standard and secure authentication flows, it currently lacks support for FAPI 2.0 specific features like mTLS/DPoP token binding and Pushed Authorization Requests (PAR). This makes it difficult to achieve the required security level for financial-grade applications. ### Describe the solution you'd like I'd like to see FAPI 2.0 support added to better-auth, specifically: 1. Support for sender-constrained tokens through either mTLS or DPoP 2. Implementation of Pushed Authorization Requests (PAR) 3. Enhanced security features required by FAPI 2.0: - Enforced PKCE with S256 - Private key JWT for client authentication - Support for stronger signing algorithms (PS256/ES256/EdDSA) 4. Other core parts of FAPI 2.0 and OAuth 2.1 These could be implemented as a new `@better-auth/fapi` package or as an optional part of the core plugins system. I summarized the core things of the technologies, you can see it in the md files. https://www.perplexity.ai/page/bff-oauth2-1-fapi-2-0-OFgzsmqfRY2q8QI.xLv2OA https://www.perplexity.ai/page/comprehensive-security-require-3SDrX4IxStaTDGwcNZYLfw Offical sources: https://oauth.net/fapi/ https://openid.net/specs/fapi-security-profile-2_0-final.html https://openid.net/specs/fapi-attacker-model-2_0-final.html https://oauth.net/2.1/ ### Describe alternatives you've considered 1. Building custom plugins - Maybe Too complex and error-prone for security-critical features, I tbh didn't dig too much into the source code 2. Using a separate auth server - Adds unnecessary infrastructure complexity and doesn't fulfill some of the security gaps 3. Implementing at the web server level - Makes the security features less integrated and harder to maintain while still not fulfilling the security gaps ### Additional context I'm willing to contribute to this feature (and also to the feature request realetd to ABAC) if there's interest, because I have to use it, and doesn't matter what open source auth library I chose for NextJS I have to write it for myself currently, because no alternatives like this support it.
GiteaMirror added the enhancementsecurity labels 2026-03-13 08:42:16 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Oct 7, 2025):

Hi, @tatarmb4s. I'm Dosu, and I'm helping the better-auth team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You requested adding FAPI 2.0 security profile and OAuth 2.1 support to better-auth.
  • Proposed features include mTLS/DPoP token binding, Pushed Authorization Requests, enforced PKCE, private key JWT, and stronger signing algorithms.
  • Suggested implementation as a new package or plugin.
  • You offered to contribute to the project.
  • No further discussion or updates have been made on this issue.

Next Steps:

  • Please let me know if this feature request is still relevant to the latest version of better-auth by commenting on this issue.
  • If I do not hear back within 7 days, I will automatically close this issue.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Oct 7, 2025): Hi, @tatarmb4s. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog and am marking this issue as stale. **Issue Summary:** - You requested adding FAPI 2.0 security profile and OAuth 2.1 support to better-auth. - Proposed features include mTLS/DPoP token binding, Pushed Authorization Requests, enforced PKCE, private key JWT, and stronger signing algorithms. - Suggested implementation as a new package or plugin. - You offered to contribute to the project. - No further discussion or updates have been made on this issue. **Next Steps:** - Please let me know if this feature request is still relevant to the latest version of better-auth by commenting on this issue. - If I do not hear back within 7 days, I will automatically close this issue. Thank you for your understanding and contribution!
Author
Owner

@gpiper14 commented on GitHub (Jan 14, 2026):

Not the original requester, but I would like bump this. Especially since some of the features like private key JWT for client authentication are supported in NextAuth/Auth.js

@gpiper14 commented on GitHub (Jan 14, 2026): Not the original requester, but I would like bump this. Especially since some of the features like private key JWT for client authentication are supported in NextAuth/Auth.js
Author
Owner

@ihasq commented on GitHub (Mar 7, 2026):

I'm interested in the DPoP aspect specifically.

I understand this was closed as not planned, but I wanted to ask: was the closure because the scope of FAPI 2.0 as a whole was too broad, or because sender-constrained tokens (DPoP/mTLS) are out of scope for Better Auth in general?

I'm asking because I think DPoP alone could be a natural fit as a standalone plugin, building on the existing bearer and JWT plugins. The use case is particularly relevant now that Better Auth has an MCP plugin — MCP clients are public clients that are inherently vulnerable to token theft, and DPoP would directly mitigate that risk.

If there's openness to a narrower proposal (DPoP plugin only, not full FAPI 2.0), I'd be willing to work on a design doc and implementation. Just want to gauge interest before investing the effort.

Thanks!

@ihasq commented on GitHub (Mar 7, 2026): I'm interested in the DPoP aspect specifically. I understand this was closed as not planned, but I wanted to ask: was the closure because the scope of FAPI 2.0 as a whole was too broad, or because sender-constrained tokens (DPoP/mTLS) are out of scope for Better Auth in general? I'm asking because I think DPoP alone could be a natural fit as a standalone plugin, building on the existing bearer and JWT plugins. The use case is particularly relevant now that Better Auth has an MCP plugin — MCP clients are public clients that are inherently vulnerable to token theft, and DPoP would directly mitigate that risk. If there's openness to a narrower proposal (DPoP plugin only, not full FAPI 2.0), I'd be willing to work on a design doc and implementation. Just want to gauge interest before investing the effort. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1476