@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.
- package/dist/api/index.d.mts +44 -1
- package/dist/api/index.mjs +40 -1
- package/dist/context/global.mjs +1 -1
- package/dist/context/transaction.d.mts +7 -4
- package/dist/context/transaction.mjs +6 -3
- package/dist/db/adapter/factory.mjs +57 -31
- package/dist/db/adapter/index.d.mts +54 -10
- package/dist/db/adapter/types.d.mts +1 -1
- package/dist/db/type.d.mts +12 -7
- package/dist/instrumentation/tracer.mjs +1 -1
- package/dist/oauth2/create-authorization-url.d.mts +3 -1
- package/dist/oauth2/create-authorization-url.mjs +3 -1
- package/dist/oauth2/dpop.d.mts +142 -0
- package/dist/oauth2/dpop.mjs +246 -0
- package/dist/oauth2/index.d.mts +4 -3
- package/dist/oauth2/index.mjs +3 -2
- package/dist/oauth2/oauth-provider.d.mts +37 -3
- package/dist/oauth2/refresh-access-token.mjs +15 -1
- package/dist/oauth2/verify.d.mts +74 -15
- package/dist/oauth2/verify.mjs +172 -20
- package/dist/social-providers/apple.d.mts +2 -0
- package/dist/social-providers/atlassian.d.mts +2 -0
- package/dist/social-providers/cognito.d.mts +2 -0
- package/dist/social-providers/discord.d.mts +2 -0
- package/dist/social-providers/dropbox.d.mts +2 -0
- package/dist/social-providers/facebook.d.mts +2 -0
- package/dist/social-providers/figma.d.mts +2 -0
- package/dist/social-providers/github.d.mts +2 -0
- package/dist/social-providers/gitlab.d.mts +2 -0
- package/dist/social-providers/google.d.mts +2 -0
- package/dist/social-providers/huggingface.d.mts +2 -0
- package/dist/social-providers/index.d.mts +71 -0
- package/dist/social-providers/kakao.d.mts +2 -0
- package/dist/social-providers/kick.d.mts +2 -0
- package/dist/social-providers/line.d.mts +2 -0
- package/dist/social-providers/linear.d.mts +2 -0
- package/dist/social-providers/linkedin.d.mts +2 -0
- package/dist/social-providers/microsoft-entra-id.d.mts +12 -0
- package/dist/social-providers/microsoft-entra-id.mjs +17 -2
- package/dist/social-providers/naver.d.mts +2 -0
- package/dist/social-providers/notion.d.mts +2 -0
- package/dist/social-providers/paybin.d.mts +2 -0
- package/dist/social-providers/paypal.d.mts +2 -0
- package/dist/social-providers/polar.d.mts +2 -0
- package/dist/social-providers/railway.d.mts +2 -0
- package/dist/social-providers/reddit.d.mts +2 -0
- package/dist/social-providers/reddit.mjs +1 -1
- package/dist/social-providers/roblox.d.mts +2 -0
- package/dist/social-providers/salesforce.d.mts +2 -0
- package/dist/social-providers/slack.d.mts +2 -0
- package/dist/social-providers/spotify.d.mts +2 -0
- package/dist/social-providers/tiktok.d.mts +2 -0
- package/dist/social-providers/twitch.d.mts +2 -0
- package/dist/social-providers/twitter.d.mts +2 -0
- package/dist/social-providers/vercel.d.mts +2 -0
- package/dist/social-providers/vk.d.mts +2 -0
- package/dist/social-providers/wechat.d.mts +2 -0
- package/dist/social-providers/wechat.mjs +1 -1
- package/dist/social-providers/zoom.d.mts +2 -0
- package/dist/types/context.d.mts +17 -0
- package/dist/types/init-options.d.mts +45 -5
- package/dist/types/plugin-client.d.mts +12 -2
- package/dist/utils/host.d.mts +1 -1
- package/dist/utils/host.mjs +7 -0
- package/dist/utils/url.mjs +4 -3
- package/package.json +5 -5
- package/src/api/index.ts +82 -0
- package/src/context/transaction.ts +45 -12
- package/src/db/adapter/factory.ts +127 -72
- package/src/db/adapter/index.ts +54 -9
- package/src/db/adapter/types.ts +1 -0
- package/src/db/type.ts +12 -7
- package/src/oauth2/create-authorization-url.ts +4 -0
- package/src/oauth2/dpop.ts +568 -0
- package/src/oauth2/index.ts +45 -1
- package/src/oauth2/oauth-provider.ts +40 -2
- package/src/oauth2/refresh-access-token.ts +27 -3
- package/src/oauth2/verify-id-token.ts +2 -0
- package/src/oauth2/verify.ts +329 -66
- package/src/social-providers/microsoft-entra-id.ts +44 -1
- package/src/social-providers/reddit.ts +5 -1
- package/src/social-providers/wechat.ts +8 -1
- package/src/types/context.ts +18 -0
- package/src/types/init-options.ts +40 -8
- package/src/types/plugin-client.ts +16 -2
- package/src/utils/host.ts +25 -1
- package/src/utils/url.ts +10 -4
package/dist/oauth2/verify.mjs
CHANGED
|
@@ -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
|
|
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
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const
|
|
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
|
|
152
|
+
fetchedAt,
|
|
153
|
+
...opts.forceRefresh && !kid ? { noKidRefetchedAt: fetchedAt } : {}
|
|
59
154
|
});
|
|
60
|
-
return
|
|
155
|
+
return {
|
|
156
|
+
jwks,
|
|
157
|
+
fromCache: false,
|
|
158
|
+
kid
|
|
159
|
+
};
|
|
61
160
|
}
|
|
62
|
-
return
|
|
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,
|
|
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;
|