@better-auth/core 1.7.0-beta.5 → 1.7.0-beta.7

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.
Files changed (87) hide show
  1. package/dist/api/index.d.mts +44 -1
  2. package/dist/api/index.mjs +40 -1
  3. package/dist/context/global.mjs +1 -1
  4. package/dist/context/transaction.d.mts +7 -4
  5. package/dist/context/transaction.mjs +6 -3
  6. package/dist/db/adapter/factory.mjs +57 -31
  7. package/dist/db/adapter/index.d.mts +54 -10
  8. package/dist/db/adapter/types.d.mts +1 -1
  9. package/dist/db/type.d.mts +12 -7
  10. package/dist/instrumentation/tracer.mjs +1 -1
  11. package/dist/oauth2/create-authorization-url.d.mts +3 -1
  12. package/dist/oauth2/create-authorization-url.mjs +3 -1
  13. package/dist/oauth2/dpop.d.mts +142 -0
  14. package/dist/oauth2/dpop.mjs +246 -0
  15. package/dist/oauth2/index.d.mts +4 -3
  16. package/dist/oauth2/index.mjs +3 -2
  17. package/dist/oauth2/oauth-provider.d.mts +37 -3
  18. package/dist/oauth2/refresh-access-token.mjs +15 -1
  19. package/dist/oauth2/verify.d.mts +74 -15
  20. package/dist/oauth2/verify.mjs +172 -20
  21. package/dist/social-providers/apple.d.mts +2 -0
  22. package/dist/social-providers/atlassian.d.mts +2 -0
  23. package/dist/social-providers/cognito.d.mts +2 -0
  24. package/dist/social-providers/discord.d.mts +2 -0
  25. package/dist/social-providers/dropbox.d.mts +2 -0
  26. package/dist/social-providers/facebook.d.mts +2 -0
  27. package/dist/social-providers/figma.d.mts +2 -0
  28. package/dist/social-providers/github.d.mts +2 -0
  29. package/dist/social-providers/gitlab.d.mts +2 -0
  30. package/dist/social-providers/google.d.mts +2 -0
  31. package/dist/social-providers/huggingface.d.mts +2 -0
  32. package/dist/social-providers/index.d.mts +71 -0
  33. package/dist/social-providers/kakao.d.mts +2 -0
  34. package/dist/social-providers/kick.d.mts +2 -0
  35. package/dist/social-providers/line.d.mts +2 -0
  36. package/dist/social-providers/linear.d.mts +2 -0
  37. package/dist/social-providers/linkedin.d.mts +2 -0
  38. package/dist/social-providers/microsoft-entra-id.d.mts +12 -0
  39. package/dist/social-providers/microsoft-entra-id.mjs +17 -2
  40. package/dist/social-providers/naver.d.mts +2 -0
  41. package/dist/social-providers/notion.d.mts +2 -0
  42. package/dist/social-providers/paybin.d.mts +2 -0
  43. package/dist/social-providers/paypal.d.mts +2 -0
  44. package/dist/social-providers/polar.d.mts +2 -0
  45. package/dist/social-providers/railway.d.mts +2 -0
  46. package/dist/social-providers/reddit.d.mts +2 -0
  47. package/dist/social-providers/reddit.mjs +1 -1
  48. package/dist/social-providers/roblox.d.mts +2 -0
  49. package/dist/social-providers/salesforce.d.mts +2 -0
  50. package/dist/social-providers/slack.d.mts +2 -0
  51. package/dist/social-providers/spotify.d.mts +2 -0
  52. package/dist/social-providers/tiktok.d.mts +2 -0
  53. package/dist/social-providers/twitch.d.mts +2 -0
  54. package/dist/social-providers/twitter.d.mts +2 -0
  55. package/dist/social-providers/vercel.d.mts +2 -0
  56. package/dist/social-providers/vk.d.mts +2 -0
  57. package/dist/social-providers/wechat.d.mts +2 -0
  58. package/dist/social-providers/wechat.mjs +1 -1
  59. package/dist/social-providers/zoom.d.mts +2 -0
  60. package/dist/types/context.d.mts +17 -0
  61. package/dist/types/init-options.d.mts +45 -5
  62. package/dist/types/plugin-client.d.mts +12 -2
  63. package/dist/utils/host.d.mts +1 -1
  64. package/dist/utils/host.mjs +7 -0
  65. package/dist/utils/url.mjs +4 -3
  66. package/package.json +5 -5
  67. package/src/api/index.ts +82 -0
  68. package/src/context/transaction.ts +45 -12
  69. package/src/db/adapter/factory.ts +127 -72
  70. package/src/db/adapter/index.ts +54 -9
  71. package/src/db/adapter/types.ts +1 -0
  72. package/src/db/type.ts +12 -7
  73. package/src/oauth2/create-authorization-url.ts +4 -0
  74. package/src/oauth2/dpop.ts +568 -0
  75. package/src/oauth2/index.ts +45 -1
  76. package/src/oauth2/oauth-provider.ts +40 -2
  77. package/src/oauth2/refresh-access-token.ts +27 -3
  78. package/src/oauth2/verify-id-token.ts +2 -0
  79. package/src/oauth2/verify.ts +329 -66
  80. package/src/social-providers/microsoft-entra-id.ts +44 -1
  81. package/src/social-providers/reddit.ts +5 -1
  82. package/src/social-providers/wechat.ts +8 -1
  83. package/src/types/context.ts +18 -0
  84. package/src/types/init-options.ts +40 -8
  85. package/src/types/plugin-client.ts +16 -2
  86. package/src/utils/host.ts +25 -1
  87. package/src/utils/url.ts +10 -4
@@ -1,4 +1,5 @@
1
1
  import { logger } from "../env/logger.mjs";
2
+ import { createInMemoryDpopReplayStore, enforceDpopBinding, getDpopJktFromPayload, isDpopBindingError, parseAccessTokenAuthorization } from "./dpop.mjs";
2
3
  import { APIError } from "better-call";
3
4
  import { UnsecuredJWT, createLocalJWKSet, decodeProtectedHeader, errors, jwtVerify } from "jose";
4
5
  import { betterFetch } from "@better-fetch/fetch";
@@ -11,13 +12,65 @@ const joseInfrastructureErrorCodes = new Set([
11
12
  function isJoseInfrastructureError(error) {
12
13
  return joseInfrastructureErrorCodes.has(error.code);
13
14
  }
15
+ /**
16
+ * @internal
17
+ */
14
18
  const jwksCache = /* @__PURE__ */ new Map();
15
19
  /**
20
+ * Cache for function jwks sources, keyed by a caller-provided stable object.
21
+ * Entries are released with their key, so per-request keys cannot accumulate.
22
+ */
23
+ const functionJwksCache = /* @__PURE__ */ new WeakMap();
24
+ /**
16
25
  * How long a cached JWKS is trusted before it is refetched
17
26
  *
18
27
  * @internal
19
28
  */
20
29
  const JWKS_CACHE_TTL_MS = 300 * 1e3;
30
+ const JWKS_NO_KID_REFETCH_COOLDOWN_MS = 30 * 1e3;
31
+ /**
32
+ * Returns the cached key set when it is within the TTL. When the token carries
33
+ * `kid`, the cached set must contain that key id; without `kid`, key selection
34
+ * is deferred to JOSE because RFC 7515 makes the header parameter optional.
35
+ */
36
+ function getFreshJwksWithKid(cached, kid) {
37
+ if (!cached) return void 0;
38
+ if (Date.now() - cached.fetchedAt >= JWKS_CACHE_TTL_MS) return void 0;
39
+ if (kid && !cached.jwks.keys.some((jwk) => jwk.kid === kid)) return;
40
+ return cached.jwks;
41
+ }
42
+ function shouldRefetchCachedJwksWithoutKid(error, resolved) {
43
+ if (!(resolved.fromCache && !resolved.kid && (error instanceof errors.JWKSNoMatchingKey || error instanceof errors.JWSSignatureVerificationFailed))) return false;
44
+ if (!resolved.noKidRefetchedAt) return true;
45
+ return Date.now() - resolved.noKidRefetchedAt >= JWKS_NO_KID_REFETCH_COOLDOWN_MS;
46
+ }
47
+ async function fetchJwks(jwksFetch) {
48
+ const jwks = typeof jwksFetch === "string" ? await betterFetch(jwksFetch, { headers: { Accept: "application/json" } }).then(async (res) => {
49
+ if (res.error) throw new Error(`Jwks failed: ${res.error.message ?? res.error.statusText}`);
50
+ return res.data;
51
+ }) : await jwksFetch();
52
+ if (!jwks) throw new Error("No jwks found");
53
+ return jwks;
54
+ }
55
+ /**
56
+ * Builds a {@link ResourceRequestInput} from a standard `Request`, reading the
57
+ * `Authorization` and `DPoP` headers and the request method and URL. Resource
58
+ * servers share this so every entry point maps the wire request the same way.
59
+ */
60
+ function requestToResourceInput(request) {
61
+ return {
62
+ authorizationHeader: request.headers.get("authorization"),
63
+ dpopProofJwt: request.headers.get("dpop"),
64
+ method: request.method,
65
+ url: request.url
66
+ };
67
+ }
68
+ /**
69
+ * Process-local, single-instance replay store. See the warning on
70
+ * {@link VerifyAccessTokenRequestOptions.dpop.replayStore}; multi-instance
71
+ * resource servers must pass their own shared store.
72
+ */
73
+ const defaultDpopReplayStore = createInMemoryDpopReplayStore();
21
74
  /**
22
75
  * Performs local verification of an access token for your APIs.
23
76
  *
@@ -25,7 +78,17 @@ const JWKS_CACHE_TTL_MS = 300 * 1e3;
25
78
  */
26
79
  async function verifyJwsAccessToken(token, opts) {
27
80
  try {
28
- const jwt = await jwtVerify(token, createLocalJWKSet(await getJwks(token, opts)), opts.verifyOptions);
81
+ const resolved = await getJwksForVerification(token, opts);
82
+ let jwt;
83
+ try {
84
+ jwt = await jwtVerify(token, createLocalJWKSet(resolved.jwks), opts.verifyOptions);
85
+ } catch (error) {
86
+ if (shouldRefetchCachedJwksWithoutKid(error, resolved)) jwt = await jwtVerify(token, createLocalJWKSet((await getJwksForVerification(token, {
87
+ ...opts,
88
+ forceRefresh: true
89
+ })).jwks), opts.verifyOptions);
90
+ else throw error;
91
+ }
29
92
  if (jwt.payload.azp) jwt.payload.client_id = jwt.payload.azp;
30
93
  return jwt.payload;
31
94
  } catch (error) {
@@ -34,6 +97,9 @@ async function verifyJwsAccessToken(token, opts) {
34
97
  }
35
98
  }
36
99
  async function getJwks(token, opts) {
100
+ return (await getJwksForVerification(token, opts)).jwks;
101
+ }
102
+ async function getJwksForVerification(token, opts) {
37
103
  let jwtHeaders;
38
104
  try {
39
105
  jwtHeaders = decodeProtectedHeader(token);
@@ -41,32 +107,65 @@ async function getJwks(token, opts) {
41
107
  if (error instanceof Error) throw error;
42
108
  throw new Error(error);
43
109
  }
44
- if (!jwtHeaders.kid) throw new APIError("UNAUTHORIZED", { message: "invalid access token" });
45
110
  const kid = jwtHeaders.kid;
111
+ if (typeof opts.jwksFetch !== "string") {
112
+ const cacheKey = opts.jwksCacheKey;
113
+ if (!cacheKey) {
114
+ const jwks = await opts.jwksFetch();
115
+ if (!jwks) throw new Error("No jwks found");
116
+ return {
117
+ jwks,
118
+ fromCache: false,
119
+ kid
120
+ };
121
+ }
122
+ const cached = functionJwksCache.get(cacheKey);
123
+ const cachedJwks = opts.forceRefresh ? void 0 : getFreshJwksWithKid(cached, kid);
124
+ if (cachedJwks) return {
125
+ jwks: cachedJwks,
126
+ fromCache: true,
127
+ kid,
128
+ noKidRefetchedAt: cached?.noKidRefetchedAt
129
+ };
130
+ const jwks = await opts.jwksFetch();
131
+ if (!jwks) throw new Error("No jwks found");
132
+ const fetchedAt = Date.now();
133
+ functionJwksCache.set(cacheKey, {
134
+ jwks,
135
+ fetchedAt,
136
+ ...opts.forceRefresh && !kid ? { noKidRefetchedAt: fetchedAt } : {}
137
+ });
138
+ return {
139
+ jwks,
140
+ fromCache: false,
141
+ kid
142
+ };
143
+ }
46
144
  const cacheKey = opts.jwksFetch;
47
145
  const cached = jwksCache.get(cacheKey);
48
- const isFresh = cached ? Date.now() - cached.fetchedAt < JWKS_CACHE_TTL_MS : false;
49
- const hasKid = cached?.jwks.keys.some((jwk) => jwk.kid === kid) ?? false;
50
- if (!cached || !isFresh || !hasKid) {
51
- const jwks = typeof opts.jwksFetch === "string" ? await betterFetch(opts.jwksFetch, { headers: { Accept: "application/json" } }).then(async (res) => {
52
- if (res.error) throw new Error(`Jwks failed: ${res.error.message ?? res.error.statusText}`);
53
- return res.data;
54
- }) : await opts.jwksFetch();
55
- if (!jwks) throw new Error("No jwks found");
146
+ const cachedJwks = opts.forceRefresh ? void 0 : getFreshJwksWithKid(cached, kid);
147
+ if (!cachedJwks) {
148
+ const jwks = await fetchJwks(opts.jwksFetch);
149
+ const fetchedAt = Date.now();
56
150
  jwksCache.set(cacheKey, {
57
151
  jwks,
58
- fetchedAt: Date.now()
152
+ fetchedAt,
153
+ ...opts.forceRefresh && !kid ? { noKidRefetchedAt: fetchedAt } : {}
59
154
  });
60
- return jwks;
155
+ return {
156
+ jwks,
157
+ fromCache: false,
158
+ kid
159
+ };
61
160
  }
62
- return cached.jwks;
161
+ return {
162
+ jwks: cachedJwks,
163
+ fromCache: true,
164
+ kid,
165
+ noKidRefetchedAt: cached?.noKidRefetchedAt
166
+ };
63
167
  }
64
- /**
65
- * Performs local verification of an access token for your API.
66
- *
67
- * Can also be configured for remote verification.
68
- */
69
- async function verifyAccessToken(token, opts) {
168
+ async function verifyAccessTokenPayload(token, opts) {
70
169
  let payload;
71
170
  if (opts.jwksUrl && !opts?.remoteVerify?.force) try {
72
171
  payload = await verifyJwsAccessToken(token, {
@@ -114,5 +213,58 @@ async function verifyAccessToken(token, opts) {
114
213
  }
115
214
  return payload;
116
215
  }
216
+ function throwDpopUnauthorized(message, error) {
217
+ throw new APIError("UNAUTHORIZED", error ? {
218
+ message,
219
+ error,
220
+ error_description: message
221
+ } : { message });
222
+ }
223
+ /**
224
+ * Performs local verification of a bearer access token for your API.
225
+ *
226
+ * Can also be configured for remote verification. DPoP-bound access tokens
227
+ * require {@link verifyAccessTokenRequest}, because sender-constraining cannot
228
+ * be verified without the HTTP method, URL, Authorization scheme, DPoP proof,
229
+ * and access-token hash. This function rejects DPoP-bound tokens; reach for it
230
+ * only when you hold a raw token string and intentionally accept bearer tokens
231
+ * alone.
232
+ */
233
+ async function verifyBearerToken(token, opts) {
234
+ const payload = await verifyAccessTokenPayload(token, opts);
235
+ if (getDpopJktFromPayload(payload)) throwDpopUnauthorized("DPoP-bound access token requires verifyAccessTokenRequest", "invalid_token");
236
+ return payload;
237
+ }
238
+ /**
239
+ * Verifies an HTTP resource request carrying an OAuth access token. This is the
240
+ * recommended resource-server entry point: it handles both bearer and
241
+ * DPoP-bound tokens, the bearer case being the request with no DPoP proof.
242
+ *
243
+ * It performs the same token validation as {@link verifyBearerToken}, then adds
244
+ * the RFC 9449 sender-constraint checks that need request context: authorization
245
+ * scheme, method, URL, DPoP proof, `ath`, and `cnf.jkt` binding.
246
+ */
247
+ async function verifyAccessTokenRequest(request, opts) {
248
+ const authorization = parseAccessTokenAuthorization(request.authorizationHeader);
249
+ if (!authorization?.token) throwDpopUnauthorized("missing authorization header");
250
+ if (authorization.scheme === "Unknown") throwDpopUnauthorized("authorization scheme must be Bearer or DPoP", "invalid_token");
251
+ const payload = await verifyAccessTokenPayload(authorization.token, opts);
252
+ try {
253
+ await enforceDpopBinding({
254
+ payload,
255
+ authorization,
256
+ proofJwt: request.dpopProofJwt,
257
+ method: request.method,
258
+ url: request.url,
259
+ replayStore: opts.dpop?.replayStore ?? defaultDpopReplayStore,
260
+ proofMaxAgeSeconds: opts.dpop?.proofMaxAgeSeconds,
261
+ signingAlgorithms: opts.dpop?.signingAlgorithms
262
+ });
263
+ } catch (error) {
264
+ if (isDpopBindingError(error)) throwDpopUnauthorized(error.message, error.code);
265
+ throw error;
266
+ }
267
+ return payload;
268
+ }
117
269
  //#endregion
118
- export { getJwks, verifyAccessToken, verifyJwsAccessToken };
270
+ export { getJwks, requestToResourceInput, verifyAccessTokenRequest, verifyBearerToken, verifyJwsAccessToken };
@@ -82,6 +82,7 @@ declare const apple: (options: AppleOptions) => {
82
82
  redirectURI: string;
83
83
  display?: string | undefined;
84
84
  loginHint?: string | undefined;
85
+ idTokenNonce?: string | undefined;
85
86
  additionalParams?: Record<string, string> | undefined;
86
87
  }): Promise<{
87
88
  url: URL;
@@ -106,6 +107,7 @@ declare const apple: (options: AppleOptions) => {
106
107
  };
107
108
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
108
109
  getUserInfo(token: OAuth2Tokens & {
110
+ expectedIdTokenNonce?: string | undefined;
109
111
  user?: {
110
112
  name?: {
111
113
  firstName?: string;
@@ -35,6 +35,7 @@ declare const atlassian: (options: AtlassianOptions) => {
35
35
  redirectURI: string;
36
36
  display?: string | undefined;
37
37
  loginHint?: string | undefined;
38
+ idTokenNonce?: string | undefined;
38
39
  additionalParams?: Record<string, string> | undefined;
39
40
  }): Promise<{
40
41
  url: URL;
@@ -52,6 +53,7 @@ declare const atlassian: (options: AtlassianOptions) => {
52
53
  }) => Promise<OAuth2Tokens>;
53
54
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
54
55
  getUserInfo(token: OAuth2Tokens & {
56
+ expectedIdTokenNonce?: string | undefined;
55
57
  user?: {
56
58
  name?: {
57
59
  firstName?: string;
@@ -63,6 +63,7 @@ declare const cognito: (options: CognitoOptions) => {
63
63
  redirectURI: string;
64
64
  display?: string | undefined;
65
65
  loginHint?: string | undefined;
66
+ idTokenNonce?: string | undefined;
66
67
  additionalParams?: Record<string, string> | undefined;
67
68
  }): Promise<{
68
69
  url: URL;
@@ -86,6 +87,7 @@ declare const cognito: (options: CognitoOptions) => {
86
87
  maxTokenAge: string;
87
88
  };
88
89
  getUserInfo(token: OAuth2Tokens & {
90
+ expectedIdTokenNonce?: string | undefined;
89
91
  user?: {
90
92
  name?: {
91
93
  firstName?: string;
@@ -90,6 +90,7 @@ declare const discord: (options: DiscordOptions) => {
90
90
  redirectURI: string;
91
91
  display?: string | undefined;
92
92
  loginHint?: string | undefined;
93
+ idTokenNonce?: string | undefined;
93
94
  additionalParams?: Record<string, string> | undefined;
94
95
  }): Promise<{
95
96
  url: URL;
@@ -106,6 +107,7 @@ declare const discord: (options: DiscordOptions) => {
106
107
  }) => Promise<OAuth2Tokens>;
107
108
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
108
109
  getUserInfo(token: OAuth2Tokens & {
110
+ expectedIdTokenNonce?: string | undefined;
109
111
  user?: {
110
112
  name?: {
111
113
  firstName?: string;
@@ -34,6 +34,7 @@ declare const dropbox: (options: DropboxOptions) => {
34
34
  redirectURI: string;
35
35
  display?: string | undefined;
36
36
  loginHint?: string | undefined;
37
+ idTokenNonce?: string | undefined;
37
38
  additionalParams?: Record<string, string> | undefined;
38
39
  }) => Promise<{
39
40
  url: URL;
@@ -51,6 +52,7 @@ declare const dropbox: (options: DropboxOptions) => {
51
52
  }) => Promise<OAuth2Tokens>;
52
53
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
53
54
  getUserInfo(token: OAuth2Tokens & {
55
+ expectedIdTokenNonce?: string | undefined;
54
56
  user?: {
55
57
  name?: {
56
58
  firstName?: string;
@@ -46,6 +46,7 @@ declare const facebook: (options: FacebookOptions) => {
46
46
  redirectURI: string;
47
47
  display?: string | undefined;
48
48
  loginHint?: string | undefined;
49
+ idTokenNonce?: string | undefined;
49
50
  additionalParams?: Record<string, string> | undefined;
50
51
  }): Promise<{
51
52
  url: URL;
@@ -76,6 +77,7 @@ declare const facebook: (options: FacebookOptions) => {
76
77
  };
77
78
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
78
79
  getUserInfo(token: OAuth2Tokens & {
80
+ expectedIdTokenNonce?: string | undefined;
79
81
  user?: {
80
82
  name?: {
81
83
  firstName?: string;
@@ -26,6 +26,7 @@ declare const figma: (options: FigmaOptions) => {
26
26
  redirectURI: string;
27
27
  display?: string | undefined;
28
28
  loginHint?: string | undefined;
29
+ idTokenNonce?: string | undefined;
29
30
  additionalParams?: Record<string, string> | undefined;
30
31
  }): Promise<{
31
32
  url: URL;
@@ -43,6 +44,7 @@ declare const figma: (options: FigmaOptions) => {
43
44
  }) => Promise<OAuth2Tokens>;
44
45
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
45
46
  getUserInfo(token: OAuth2Tokens & {
47
+ expectedIdTokenNonce?: string | undefined;
46
48
  user?: {
47
49
  name?: {
48
50
  firstName?: string;
@@ -67,6 +67,7 @@ declare const github: (options: GithubOptions) => {
67
67
  redirectURI: string;
68
68
  display?: string | undefined;
69
69
  loginHint?: string | undefined;
70
+ idTokenNonce?: string | undefined;
70
71
  additionalParams?: Record<string, string> | undefined;
71
72
  }): Promise<{
72
73
  url: URL;
@@ -84,6 +85,7 @@ declare const github: (options: GithubOptions) => {
84
85
  }) => Promise<OAuth2Tokens | null>;
85
86
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
86
87
  getUserInfo(token: OAuth2Tokens & {
88
+ expectedIdTokenNonce?: string | undefined;
87
89
  user?: {
88
90
  name?: {
89
91
  firstName?: string;
@@ -67,6 +67,7 @@ declare const gitlab: (options: GitlabOptions) => {
67
67
  redirectURI: string;
68
68
  display?: string | undefined;
69
69
  loginHint?: string | undefined;
70
+ idTokenNonce?: string | undefined;
70
71
  additionalParams?: Record<string, string> | undefined;
71
72
  }) => Promise<{
72
73
  url: URL;
@@ -84,6 +85,7 @@ declare const gitlab: (options: GitlabOptions) => {
84
85
  }) => Promise<OAuth2Tokens>;
85
86
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
86
87
  getUserInfo(token: OAuth2Tokens & {
88
+ expectedIdTokenNonce?: string | undefined;
87
89
  user?: {
88
90
  name?: {
89
91
  firstName?: string;
@@ -76,6 +76,7 @@ declare const google: (options: GoogleOptions) => {
76
76
  redirectURI: string;
77
77
  display?: string | undefined;
78
78
  loginHint?: string | undefined;
79
+ idTokenNonce?: string | undefined;
79
80
  additionalParams?: Record<string, string> | undefined;
80
81
  }): Promise<{
81
82
  url: URL;
@@ -100,6 +101,7 @@ declare const google: (options: GoogleOptions) => {
100
101
  verifyClaims: ((claims: Record<string, unknown>) => boolean) | undefined;
101
102
  };
102
103
  getUserInfo(token: OAuth2Tokens & {
104
+ expectedIdTokenNonce?: string | undefined;
103
105
  user?: {
104
106
  name?: {
105
107
  firstName?: string;
@@ -48,6 +48,7 @@ declare const huggingface: (options: HuggingFaceOptions) => {
48
48
  redirectURI: string;
49
49
  display?: string | undefined;
50
50
  loginHint?: string | undefined;
51
+ idTokenNonce?: string | undefined;
51
52
  additionalParams?: Record<string, string> | undefined;
52
53
  }): Promise<{
53
54
  url: URL;
@@ -65,6 +66,7 @@ declare const huggingface: (options: HuggingFaceOptions) => {
65
66
  }) => Promise<OAuth2Tokens>;
66
67
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
67
68
  getUserInfo(token: OAuth2Tokens & {
69
+ expectedIdTokenNonce?: string | undefined;
68
70
  user?: {
69
71
  name?: {
70
72
  firstName?: string;