Commit Graph
346 Commits
Author SHA1 Message Date
Gustavo Valverde 0eb76b89ca fix: preserve public token endpoint requests 2026-05-16 21:00:10 +01:00
Gustavo Valverde 50da863e81 fix: enforce public token auth invariants 2026-05-16 20:59:47 +01:00
Gustavo Valverde 480a782d3e fix: validate token endpoint client IDs 2026-05-16 20:59:47 +01:00
Gustavo Valverde 6f50fbd4b4 feat: add token endpoint client authentication 2026-05-16 20:59:47 +01:00
Gustavo Valverde 4a3ede0e29 fix(core): honor options-level client assertions 2026-05-16 20:56:42 +01:00
ItalyPaleAleandGustavo Valverde 23041d94fd feat: add JWT client assertion OAuth2 support (next)
> This is a re-do of #9418 for the `next` branch, where #8836 was merged. As discussed via Slack, backwards compatibility did not need to be maintained.

This is based on RFC 7523

It allows configuring an OAuth2 provider with a `clientAssertionProvider` instead of a `clientSecret`, so omitting long-lived credentials.

This PR is currently not concerned with what providers support (or will support) client assertions. It is also not concerned with _how_ the assertion is obtained: could be a Kubernetes token, a token from a cloud platform, etc.

This PR refactors/extends #8836, which was limited to supporting assertions generated locally with a private key (which, while having broader support in the ecosystem, still involves long-lived secrets). Support for those assertions is available by passing `createPrivateKeyJwtClientAssertionProvider(opts)` to the `clientAssertionProvider` property.

This was implemented by #8836 and it's refactored here so it works in a more generic way.

With this PR, JWTs can be signed with a local assertion:

```ts
import { betterAuth } from "better-auth";
import { genericOAuth } from "better-auth/plugins/generic-oauth";
import { createPrivateKeyJwtClientAssertionProvider } from "better-auth/oauth2";

genericOAuth({
  config: [
    {
      providerId: "my-idp",
      discoveryUrl: "https://idp.example.com/.well-known/openid-configuration",
      clientId: process.env.IDP_CLIENT_ID!,
      // Replaces clientSecret
      clientAssertionProvider: createPrivateKeyJwtClientAssertionProvider({
        clientId: "your-client-id",
        tokenEndpoint: "https://idp.example.com/oauth/token",
        privateKeyJwk: { /* your JWK */ },
        kid: "my-key-1",
        algorithm: "RS256",
      }),
      pkce: true,
    },
  ],
});
```

For an application running on Vercel and authenticating with a generic OAuth2 provider (e.g. Pocket ID), you can now configure better-auth with:

```ts
import { getVercelOidcToken } from '@vercel/oidc'

genericOAuth({
  config: [
    {
      providerId: "my-idp",
      discoveryUrl: "https://idp.example.com/.well-known/openid-configuration",
      clientId: process.env.IDP_CLIENT_ID!,
      // Replaces clientSecret
      clientAssertionProvider: async (): Promise<string> => {
        return getVercelOidcToken()
      },
      pkce: true,
    },
  ],
});
```

You then just need to configure your application in the IdP to accept federation with these values:

- Issuer: `https://oidc.vercel.com/<vercel-team>`
- Audience: `https://vercel.com/<vercel-team>`
- Subject: `owner:<vercel-team>:project:<project-name>:environment:production`
2026-05-16 20:56:42 +01:00
better-release[bot]andGitHub f41514ef07 chore: release v1.6.11 (#9532) 2026-05-12 17:30:34 +01:00
MaxwellandGitHub b0ef96fd8e fix: invalid instrumentation import list (#9582) 2026-05-12 15:03:15 +00:00
Gustavo ValverdeandGitHub da7e50beee fix(oauth): block OAuth linking to unverified local accounts (#9578) 2026-05-12 14:20:19 +00:00
Gustavo ValverdeandGitHub 0cbddb8fa4 refactor(db): rename claimOne adapter primitive to consumeOne (#9568) 2026-05-12 07:44:07 +00:00
TaesuandGitHub 62b8793c11 chore(deps): consolidate kysely into pnpm catalog (#9569) 2026-05-12 07:38:59 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Taesu
3bec284c4f chore(deps): bump kysely from 0.28.14 to 0.28.17 (#9567)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Taesu <bytaesu@gmail.com>
2026-05-12 06:25:23 +00:00
Gustavo ValverdeandGitHub a2c0c9346e feat(db): add atomic claimOne adapter primitive (#9560) 2026-05-11 20:10:29 +00:00
MaxwellandGitHub ee93485499 fix: add error code to change-email-disabled (#8948) 2026-05-11 11:49:38 +00:00
Gustavo ValverdeandGitHub e21d744987 fix(rate-limit): widen ipv6Subnet type and correct default in docs (#9545) 2026-05-11 07:04:16 +00:00
better-release[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
cbb5014cdf chore: release v1.6.10 (#9350)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-05-09 14:31:47 +00:00
TaesuandGitHub 15ff28a957 fix(internal-adapter): rename deleteAccount param from accountId to id (#9503) 2026-05-09 13:50:32 +00:00
3a9a2c37ee chore: expose refreshUserSessions on internal adapter (#7764)
Co-authored-by: Maxwell <145994855+ping-maxwell@users.noreply.github.com>
Co-authored-by: ping-maxwell <maxwell.multinite@gmail.com>
2026-05-07 10:17:56 +00:00
2220a6d6c2 fix(core): use pure instrumentation entry for workerd (#9395)
Co-authored-by: cyphercodes <7407177+cyphercodes@users.noreply.github.com>
2026-04-29 12:59:31 -07:00
better-release[bot]andGitHub f484269228 chore: release v1.6.9 (#9341) 2026-04-24 06:25:08 +01:00
815ecf62b6 fix(core): resolve instrumentation via package self-reference in adapter factory (#9340)
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-24 05:12:34 +00:00
better-release[bot]andGitHub b289ac6c4b chore: release v1.6.8 (#9316) 2026-04-23 11:31:03 +01:00
Gustavo ValverdeandGitHub 9aa8e63de8 fix(oauth): support mapProfileToUser fallback for providers that may omit email (#9331) 2026-04-23 10:15:36 +00:00
better-release[bot]andGitHub f8076d141a chore: release v1.6.7 (#9289) 2026-04-22 12:36:30 +01:00
Gustavo ValverdeandGitHub 4f373eed8a feat(social-providers): accept array of Client IDs for ID token audience (#9292) 2026-04-22 09:02:56 +00:00
RayandGitHub 4a180f0b0c fix(core): serve noop ./instrumentation on browser and edge conditions (#9281) 2026-04-22 08:44:00 +00:00
307196a405 fix(api): preserve response headers when APIError is thrown (#9211)
Co-authored-by: Maxwell <145994855+ping-maxwell@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 06:47:16 +00:00
better-release[bot]andGitHub 0290077760 chore: release v1.6.6 (#9222) 2026-04-21 17:42:18 +01:00
TaesuandGitHub b5742f9d08 feat(core): add mapConcurrent bounded-concurrency utility (#9227) 2026-04-21 15:31:08 +00:00
Gustavo ValverdeandGitHub e64ff720fb fix: unify host classification and close SSRF gaps across packages (#9226) 2026-04-17 23:25:25 +00:00
a844c7dd08 chore(core): update @opentelemetry/api dep declaration to be optional (#9111)
Co-authored-by: Taesu <166604494+bytaesu@users.noreply.github.com>
2026-04-17 14:26:40 +00:00
better-release[bot]andGitHub c8a91f4167 chore: release v1.6.5 (#9209) 2026-04-16 11:05:30 +01:00
better-release[bot]andGitHub 9ec849ff71 chore: release v1.6.4 (#9175) 2026-04-15 13:00:42 +01:00
acbd6ef69f fix: honor forceAllowId UUIDs on postgres adapters (#9068)
Co-authored-by: Maxwell <145994855+ping-maxwell@users.noreply.github.com>
2026-04-14 13:05:11 +00:00
better-release[bot]andGitHub 6f17bb3ebd chore: release v1.6.3 (#9081) 2026-04-14 12:04:31 +01:00
better-release[bot]andGitHub 700d298e1e chore: version packages (#9052) 2026-04-09 15:19:07 +01:00
better-release[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
85bb710edc chore: version packages (#9018)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-04-08 19:22:59 +00:00
better-release[bot] d666a03372 chore: exit pre-release mode for v1.6.0 2026-04-06 14:41:56 +00:00
Gustavo ValverdeandGitHub 29d197e688 chore: sync main to next (#8976)
chore: sync main to next
2026-04-06 15:31:29 +01:00
TaesuandGitHub 475d512376 chore: revert better-call v2 migration, downgrade to v1.3.5 (#8973) 2026-04-05 23:18:54 +00:00
better-auth-releases[bot]andgithub-actions[bot] <github-actions[bot]@users.noreply.github.com> 73beda26f9 chore: version packages (beta) (#8945)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-04-04 15:52:24 +00:00
5970053e6a docs: improve descriptions for appName, trustedOrigins, useSecureCookies (#8935)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 18:31:00 +00:00
Gustavo ValverdeandGitHub 77ead28455 chore: reset package versions to 1.5.6 (#8930) 2026-04-03 10:57:28 +00:00
Gustavo ValverdeandGitHub e80cc38b0d fix: turbo caching, enforce lockfile integrity, expand pre-commit hooks (#8892) 2026-04-02 07:35:24 +00:00
Gustavo ValverdeandGitHub 04e91d1643 perf(build): reduce published package sizes (#8884) 2026-04-01 15:55:03 +00:00
31d5e88b88 fix(instrumentation): don't mark redirect APIErrors as span errors (#8850)
Co-authored-by: Maxwell <145994855+ping-maxwell@users.noreply.github.com>
2026-04-01 22:49:49 +10:00
Jonathan SaminesandGitHub cd01a42e60 feat: expose plugin version (#8750) 2026-03-31 16:08:21 +00:00
Ruban SandGitHub 75133eb478 chore: remove duplicate export for linkedin (#8859) 2026-03-31 12:54:46 +00:00
Jonathan SaminesandGitHub a1b0fdcd70 feat(db): add case insensitive queries support (#8556) 2026-03-23 13:09:29 -07:00
Bereket Engida 841410031a chore: release v1.5.7-beta.1 2026-03-22 21:09:52 -07:00