Commit Graph

1481 Commits

Author SHA1 Message Date
Dylan Vanmali
686fba4e11 feat(oauth-provider): an oauth 2.1 compliant plugin (#4163)
An upgrade to oidc-provider plugin that makes it oauth2.1 compliant and has a configuration that is secure by default.

Plans for the deprecation of oidc-provider plugin due to many inherent flaws in its design. Internally, plugin functions now share logic, providing for better future extensibility if new code_grants need to be written or user/client jwt or opaque tokens need to be written. Furthermore, as an oAuth 2.1 provider, it provides logic valid for an MCP server. When using the scope "openid" (optional, enabled by default), the server acts like an OpenId server able to issue id tokens and provides a /userinfo endpoint.

Features

OAuth 2.1 by default
Properly supports authorization_code, refresh_token, and client_credentials grants
PKCE by default (removes plain completely)
Public and confidential client registration
JWT plugin is required by default, but can be disabled using disableJWTPlugin flag
Access tokens can now be received in JWT verifiable format using the resource parameter (ie JWT aud field)
Id tokens are still verifiable by JWKS when using JWT Plugin, or clientSecret if disabled. Fixes issue to prevent public clients when disableJWTPlugin: true from obtaining id tokens directly even when they shouldn't be allowed an id token and should use /userinfo instead.
Protects /userinfo with scope check
Separates Refresh Token and Access token on database schema to allow multiple access tokens per refresh and multiple refresh tokens per login session.
oauthAccessToken strictly deals with opaque tokens
Opaque tokens are given only when resource parameter (aka audience) is not provided
Option to Encode and Decode refresh tokens
allowDynamicClientRegistration with allowUnauthenticatedClientRegistration flags
Separation of default expiration times
Proper creation of public and confidential clients
Prevents misconfiguration between .well-known/openid-configuration endpoint and plugin settings
scopeExpirations to assign scopes specific expiration
Custom claims through separated functions: customAccessTokenClaims, customIdTokenClaims, and customUserInfoClaims
Organizational support through activeOrganizationalId on a session such as through the organizational plugin. Attaches to oAuthClient via reference_id.
Rp-initiated logout
Account Selection via prompt=select_account.
Account Creation via prompt=create.
Prompt combinations prompt=select_account+consent and prompt=login+consent

Docs available at https://www.better-auth.com/docs/plugins/oauth-provider (pr: https://github.com/better-auth/better-auth/blob/main/docs/content/docs/plugins/oauth-provider.mdx)
2025-12-22 11:16:42 -08:00
Shoubhit Dash
d544ba97f9 feat: add a global backgroundTasks config option to defer actions like sending email and updates to run after response is sent (#6713)
Co-authored-by: Bereket Engida <86073083+Bekacru@users.noreply.github.com>
Co-authored-by: Bereket Engida <Bekacru@gmail.com>
2025-12-20 11:43:03 -08:00
Bereket Engida
30dc04b12f docs(organization): update default organization limit to 'unlimited' (#6808)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-20 07:38:11 -08:00
Alex Yang
6743a7a84b docs: clarify username sign-in functionality in documentation (#6901)
Co-authored-by: Jilles Soeters <jilleswf@gmail.com>
2025-12-20 16:17:04 +08:00
vijit-lark
cfb56fdab4 docs: add community plugin Lark billing (#6813) 2025-12-19 18:06:23 -08:00
Mauricio Galvez
becb4e96ee docs: fix typo in Organization plugin docs (#6885) 2025-12-19 16:41:04 -08:00
Paola Estefanía de Campos
65193cb56d doc(auth): clarify trustedOrigins callback request parameter (#6890) 2025-12-19 16:40:37 -08:00
Paola Estefanía de Campos
19d2b3a990 fix(auth): respect trustedOrigins when baseURL is inferred (#6882) 2025-12-19 09:08:37 -08:00
Taesu
e9cd882f1f docs: use dotenv instead of env (#6883) 2025-12-19 09:03:46 -08:00
Alex Yang
373a1c658a docs: fix twitter id 2025-12-19 22:25:00 +08:00
Gautam Manchandani
4981827262 docs: add baseURL configuration warning to Google provider (#6878)
Co-authored-by: Gautam Manchandani <gautammanch@Gautams-MacBook-Air.local>
2025-12-19 20:00:13 +08:00
Taesu
8a67c2be76 chore: remove unnecessary custom word (#6825) 2025-12-18 21:57:23 -08:00
Soham Datta
519bdb1014 docs(convex): fix import statement for authConfig (#6861) 2025-12-19 13:27:53 +08:00
Taesu
d3ebfacd91 fix: respect IP headers in dev/test environments (#6854) 2025-12-18 20:25:10 +08:00
Bennett Dams
3897be5603 docs: change role type from string to enum values (#6844) 2025-12-18 14:23:57 +08:00
Dominik K.
e973bd95be docs(convex): clean up documentation (#6829) 2025-12-18 10:27:36 +08:00
Dominik K.
9bf9ad88b5 docs(polar): update client import (#6830) 2025-12-18 10:26:43 +08:00
Anmol
0227dde8ec docs: uses latest getRequestHeaders() to grab headers from request in Auth Middleware in Tanstack Start (#6824) 2025-12-17 13:20:38 -08:00
Nico Labarre
07cdd67dae feat: add patreon social provider (#6245)
Co-authored-by: benkingcode <ben@lionfeet.com>
Co-authored-by: Kinfe123 <kinfishtech@gmail.com>
2025-12-17 11:57:00 +08:00
Paola Estefanía de Campos
2053f22bbf feat(saml): enforce one-time use of SAML assertions (#6719) 2025-12-16 17:32:19 -08:00
Shawn Erquhart
da103d92a0 docs(convex): update guide for Convex component 0.10 (#6811) 2025-12-16 16:36:05 -08:00
Paola Estefanía de Campos
b56d7b8eaa feat(saml): validate SAML crypto algorithms during initial phase (#6785) 2025-12-15 14:40:08 -08:00
Brian Cooper
6da61bba77 docs: restrict SIWE example nonce generation characters (#6741) 2025-12-13 22:56:41 -08:00
Gaga86
cce3456c1c docs: updated the accountInfo server side example (#6692) 2025-12-14 14:29:37 +09:00
Joél Solano
ef952e5739 docs(expo): fix code examples (#6731) 2025-12-14 14:28:21 +09:00
Gautam Manchandani
a91c021d40 docs(oidc-provider): fix incorrect redirectURLs property name (#6734)
Co-authored-by: Gautam Manchandani <gautammanch@Gautams-MacBook-Air.local>
2025-12-14 14:14:38 +09:00
Bereket Engida
4cdf869c67 feat(phone-number): add password length validation for reset functionality (#6674) 2025-12-13 15:51:03 -08:00
Taesu
4439b52d66 docs: correct codeblock title (#6708) 2025-12-12 18:44:10 -08:00
Maxwell
8c44d852fa docs(organization): add missing organizationRole schema (#6714) 2025-12-12 09:45:45 -08:00
Jonathan Samines
17ff1a01e3 feat(sso): add URL normalization and validation to all discovery URLs (#6503)
Co-authored-by: Paola Estefanía de Campos <paolaestefania.decampos@gmail.com>
Co-authored-by: Paola Estefanía de Campos <84341268+Paola3stefania@users.noreply.github.com>
Co-authored-by: Bereket Engida <Bekacru@gmail.com>
Co-authored-by: Bereket Engida <86073083+Bekacru@users.noreply.github.com>
2025-12-12 09:18:16 -08:00
Paola Estefanía de Campos
90c597a9d2 feat(saml): assertion timestamp validation with per-provider clock skew (#6706) 2025-12-11 23:01:49 -08:00
Paola Estefanía de Campos
57400bf2a0 feat(sso): add OIDC discovery (#6395)
Co-authored-by: Bereket Engida <Bekacru@gmail.com>
Co-authored-by: Bereket Engida <86073083+Bekacru@users.noreply.github.com>
2025-12-11 17:46:55 -08:00
Paola Estefanía de Campos
50ffecbfad feat(sso): add InResponseTo validation (#6557) 2025-12-11 15:57:00 -08:00
Saviru
97bfdcb345 docs: add Argon2 password hashing example (#6688) 2025-12-11 15:45:53 +09:00
Jonathan Samines
5f89bfa076 docs(sso): fix default sso docs (#6640) 2025-12-09 09:42:50 -08:00
Gabriel Ferraz
b7b360aaf8 docs: creem subscription database schema changes (#6375) 2025-12-08 21:56:36 -08:00
Cryze
d3646df329 docs: correct typo in backup code recovery method description (#6374) 2025-12-08 21:56:25 -08:00
Bereket Engida
e26fc6fc29 Revert "feat(multi-session): allow to infer additional fields (#6585)"
This reverts commit 137863c5b2.
2025-12-08 16:45:49 -08:00
Joél Solano
381f25fb5c feat(expo): last-login-method client plugin (#6413)
Co-authored-by: Alex Yang <himself65@outlook.com>
2025-12-08 16:24:56 -08:00
Joél Solano
137863c5b2 feat(multi-session): allow to infer additional fields (#6585) 2025-12-09 09:22:25 +09:00
Joél Solano
5fb835ab28 feat(admin): prevent impersonating admins by default [breaking] (#6454)
Co-authored-by: Bereket Engida <86073083+Bekacru@users.noreply.github.com>
2025-12-08 16:05:38 -08:00
Rodrigo Ehlers
51c119f76e docs: remove/rephrase wrong statement about permissions and projects (#6586) 2025-12-08 16:02:18 -08:00
Jaren Goldberg
44aa11d3f9 docs: add better-auth-university community plugin (#6594)
Co-authored-by: Bereket Engida <86073083+Bekacru@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-08 15:54:41 -08:00
Paola Estefanía de Campos
c56622b38f fix(sso): deprecate trustEmailVerified (#6616) 2025-12-08 15:53:20 -08:00
Taesu
d57572d962 docs: add WorkOS migration guide (#6577)
Co-authored-by: Bereket Engida <Bekacru@gmail.com>
Co-authored-by: Bereket Engida <86073083+Bekacru@users.noreply.github.com>
2025-12-08 14:18:55 -08:00
Paola Estefanía de Campos
6f2831163b feat(sso): use domain verified flag to trust providers automatically 2025-12-08 13:12:14 -08:00
Joél Solano
59aca25bec docs(org): remove reference to non-existent option (#6587) 2025-12-08 09:11:54 -08:00
Maxwell
284351abcf docs(bearer): explain bearer requests requirements better (#6591) 2025-12-07 11:23:55 -08:00
Bereket Engida
b1ea1f520f docs: update convex guide callout (#6570) 2025-12-06 10:03:22 -08:00
Bereket Engida
9f6b8e753d feat(oauth-proxy): add expirty timestamp for encrypted tokens (#6538)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-05 18:38:56 -08:00