@better-auth/oauth-provider 1.7.0-rc.5 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,9 +2,9 @@ import * as z from "zod";
2
2
  import { PrivateKeyJwtSigningAlgorithm } from "@better-auth/core/oauth2";
3
3
  import { JWTPayload } from "jose";
4
4
  import { JWSAlgorithms } from "better-auth/plugins";
5
- import "@better-auth/core/utils/redirect-uri";
6
5
  import { InferOptionSchema, Session, User } from "better-auth/types";
7
6
  import { GenericEndpointContext, LiteralString } from "@better-auth/core";
7
+
8
8
  //#region src/schema.d.ts
9
9
  declare const schema: {
10
10
  oauthClient: {
@@ -1256,7 +1256,7 @@ interface OAuthOptions<Scopes extends readonly Scope[] = InternallySupportedScop
1256
1256
  * @example
1257
1257
  * { "write:payments": "5m", "read:payments": "30m" }
1258
1258
  */
1259
- scopeExpirations?: { [K in Scopes[number]]?: number | string | Date; };
1259
+ scopeExpirations?: { [K in Scopes[number]]?: number | string | Date };
1260
1260
  /**
1261
1261
  * Maximum lifetime in seconds for client assertion JWTs
1262
1262
  * used with `private_key_jwt` authentication.
@@ -1651,12 +1651,10 @@ interface OAuthOptions<Scopes extends readonly Scope[] = InternallySupportedScop
1651
1651
  * @returns Additional claims for userinfo request
1652
1652
  */
1653
1653
  customUserInfoClaims?: (info: {
1654
- /** The user object */
1655
- user: User & Record<string, unknown>;
1654
+ /** The user object */user: User & Record<string, unknown>;
1656
1655
  /** The scopes from the access token used
1657
1656
  * in the /userinfo request (matches jwt.scopes) */
1658
- scopes: Scopes;
1659
- /** The access token payload used in the /userinfo request */
1657
+ scopes: Scopes; /** The access token payload used in the /userinfo request */
1660
1658
  jwt: JWTPayload;
1661
1659
  /**
1662
1660
  * Claim names explicitly requested through the OIDC `claims.userinfo`
@@ -1680,11 +1678,8 @@ interface OAuthOptions<Scopes extends readonly Scope[] = InternallySupportedScop
1680
1678
  * @param info - context that may be useful when creating custom claims
1681
1679
  */
1682
1680
  customIdTokenClaims?: (info: {
1683
- /** The user object if token is associated to a user. */
1684
- user: User & Record<string, unknown>;
1685
- /** Scopes granted for this token */
1686
- scopes: Scopes;
1687
- /** oAuthClient metadata */
1681
+ /** The user object if token is associated to a user. */user: User & Record<string, unknown>; /** Scopes granted for this token */
1682
+ scopes: Scopes; /** oAuthClient metadata */
1688
1683
  metadata?: Record<string, any>;
1689
1684
  }) => Awaitable<Record<string, any>>;
1690
1685
  /**
@@ -1701,15 +1696,10 @@ interface OAuthOptions<Scopes extends readonly Scope[] = InternallySupportedScop
1701
1696
  * @param info - context that may be useful when creating custom claims
1702
1697
  */
1703
1698
  customAccessTokenClaims?: (info: {
1704
- /** The user object if token is associated to a user. Null if user doesn't exist. Undefined if user not applicable. */
1705
- user?: (User & Record<string, unknown>) | null;
1706
- /** reference of the consent/authorization */
1707
- referenceId?: string;
1708
- /** Scopes granted for this token */
1709
- scopes: Scopes;
1710
- /** The resources requested. */
1711
- resources?: string[];
1712
- /** oAuthClient metadata */
1699
+ /** The user object if token is associated to a user. Null if user doesn't exist. Undefined if user not applicable. */user?: (User & Record<string, unknown>) | null; /** reference of the consent/authorization */
1700
+ referenceId?: string; /** Scopes granted for this token */
1701
+ scopes: Scopes; /** The resources requested. */
1702
+ resources?: string[]; /** oAuthClient metadata */
1713
1703
  metadata?: Record<string, any>;
1714
1704
  }) => Awaitable<Record<string, any>>;
1715
1705
  /**
@@ -1724,17 +1714,14 @@ interface OAuthOptions<Scopes extends readonly Scope[] = InternallySupportedScop
1724
1714
  * @param info - context that may be useful when creating custom fields
1725
1715
  */
1726
1716
  customTokenResponseFields?: (info: {
1727
- /** The grant type being processed */
1728
- grantType: GrantType;
1717
+ /** The grant type being processed */grantType: GrantType;
1729
1718
  /**
1730
1719
  * The user, if applicable.
1731
1720
  * Undefined for `client_credentials` (M2M, no user).
1732
1721
  * Always present for `authorization_code` and `refresh_token`.
1733
1722
  */
1734
- user?: (User & Record<string, unknown>) | null;
1735
- /** Scopes granted for this token */
1736
- scopes: Scopes;
1737
- /** oAuthClient metadata */
1723
+ user?: (User & Record<string, unknown>) | null; /** Scopes granted for this token */
1724
+ scopes: Scopes; /** oAuthClient metadata */
1738
1725
  metadata?: Record<string, any>;
1739
1726
  /**
1740
1727
  * The authorization code verification value.