@better-auth/electron 1.7.0-beta.4 → 1.7.0-beta.5
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/{client-DIzl-aw0.d.mts → client-D5QKMJbp.d.mts} +12 -17
- package/dist/client.d.mts +1 -1
- package/dist/client.mjs +6 -7
- package/dist/index.d.mts +2 -8
- package/dist/index.mjs +6 -25
- package/dist/preload.d.mts +508 -72
- package/dist/preload.mjs +1 -1
- package/dist/proxy.d.mts +1 -1
- package/dist/proxy.mjs +1 -1
- package/dist/storage.d.mts +1 -1
- package/dist/{version-5EiO_U3Z.mjs → version-DzWb5tB_.mjs} +1 -1
- package/package.json +7 -7
package/dist/preload.d.mts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import electron from "electron";
|
|
2
2
|
import * as z from "zod";
|
|
3
|
+
import * as jose from "jose";
|
|
4
|
+
import { JWTVerifyGetKey } from "jose";
|
|
3
5
|
import { Database } from "bun:sqlite";
|
|
4
6
|
import { DatabaseSync } from "node:sqlite";
|
|
5
7
|
import { D1Database } from "@cloudflare/workers-types";
|
|
@@ -644,6 +646,52 @@ declare const createLogger: (options?: Logger | undefined) => InternalLogger;
|
|
|
644
646
|
//#endregion
|
|
645
647
|
//#region ../core/dist/oauth2/oauth-provider.d.mts
|
|
646
648
|
//#region src/oauth2/oauth-provider.d.ts
|
|
649
|
+
/**
|
|
650
|
+
* id_token verification config for a social provider.
|
|
651
|
+
*
|
|
652
|
+
* Declares how a client-submitted id_token is verified. The shared verifier
|
|
653
|
+
* (`verifyProviderIdToken`) consumes this instead of each provider implementing its own
|
|
654
|
+
* boolean check, so verification is centralized and fail-closed: a provider without a config
|
|
655
|
+
* cannot accept a forged token by omission.
|
|
656
|
+
*/
|
|
657
|
+
type OAuthIdTokenConfig = {
|
|
658
|
+
/**
|
|
659
|
+
* JWKS resolver used to verify the JWS signature. Accepts a jose
|
|
660
|
+
* `createRemoteJWKSet` resolver or a key-resolving function
|
|
661
|
+
* `(protectedHeader) => key`.
|
|
662
|
+
*/
|
|
663
|
+
jwks: JWTVerifyGetKey; /** Expected `iss`. Omit for providers whose issuer varies per tenant. */
|
|
664
|
+
issuer?: (string | string[]) | undefined; /** Expected `aud`, usually the client ID. */
|
|
665
|
+
audience: string | string[]; /** Permitted JWS algorithms. Defaults to the token's `alg` header. */
|
|
666
|
+
algorithms?: string[] | undefined; /** Maximum token age passed to jose (e.g. `"1h"`). */
|
|
667
|
+
maxTokenAge?: string | undefined;
|
|
668
|
+
/**
|
|
669
|
+
* How the `nonce` claim is compared to the expected nonce.
|
|
670
|
+
* - `"exact"` (default): strict equality.
|
|
671
|
+
* - `"exact-or-sha256"`: matches the raw nonce or its SHA-256 hex digest (Apple).
|
|
672
|
+
*/
|
|
673
|
+
nonceComparison?: ("exact" | "exact-or-sha256") | undefined;
|
|
674
|
+
/**
|
|
675
|
+
* Accept non-JWS (opaque) tokens without signature verification. Identity is then
|
|
676
|
+
* resolved by getUserInfo from the access token via the provider userinfo endpoint,
|
|
677
|
+
* which validates it (e.g. Facebook Graph access tokens).
|
|
678
|
+
*/
|
|
679
|
+
allowOpaqueToken?: boolean | undefined;
|
|
680
|
+
/**
|
|
681
|
+
* Provider-specific claim check applied after the signature, issuer,
|
|
682
|
+
* audience, max-age, and nonce checks pass. Return `false` to reject the
|
|
683
|
+
* token. Used to enforce constraints the standard checks cannot express,
|
|
684
|
+
* e.g. Google's hosted-domain (`hd`) restriction. Omitted by providers
|
|
685
|
+
* that have no extra claim requirement.
|
|
686
|
+
*/
|
|
687
|
+
verifyClaims?: ((claims: Record<string, unknown>) => boolean) | undefined;
|
|
688
|
+
} | {
|
|
689
|
+
/**
|
|
690
|
+
* Custom verifier for providers that cannot verify against a local JWKS, such as a
|
|
691
|
+
* remote verification endpoint (e.g. LINE).
|
|
692
|
+
*/
|
|
693
|
+
verify: (token: string, nonce?: string) => Promise<boolean>;
|
|
694
|
+
};
|
|
647
695
|
interface OAuth2Tokens {
|
|
648
696
|
tokenType?: string | undefined;
|
|
649
697
|
accessToken?: string | undefined;
|
|
@@ -665,8 +713,58 @@ type OAuth2UserInfo = {
|
|
|
665
713
|
image?: string | undefined;
|
|
666
714
|
emailVerified: boolean;
|
|
667
715
|
};
|
|
668
|
-
|
|
716
|
+
/**
|
|
717
|
+
* The result of building a provider authorization URL.
|
|
718
|
+
*
|
|
719
|
+
* `requestedScopes` is the effective set of scopes encoded in the URL (the
|
|
720
|
+
* provider's built-in defaults + configured `options.scope` + per-request
|
|
721
|
+
* `scopes`, composed by `resolveRequestedScopes`). Callers persist it so the
|
|
722
|
+
* callback can fall back to the request when the provider omits `scope` from
|
|
723
|
+
* its token response (RFC 6749 §5.1).
|
|
724
|
+
*/
|
|
725
|
+
interface AuthorizationURLResult {
|
|
726
|
+
url: URL;
|
|
727
|
+
requestedScopes: string[];
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* How much an RP trusts a provider's echoed token-response `scope` when
|
|
731
|
+
* persisting `account.grantedScopes`.
|
|
732
|
+
*
|
|
733
|
+
* - `"full-grant"`: the echo is the user's complete current grant, so the seam
|
|
734
|
+
* replaces the stored grant with it. This is the only path that may narrow
|
|
735
|
+
* the grant. Declare it only for providers whose token response reports the
|
|
736
|
+
* full combined grant, e.g. Google with `include_granted_scopes`.
|
|
737
|
+
* - `"projection"`: the echo is this request's subset, so the seam unions it
|
|
738
|
+
* onto the stored grant. The safe default for every provider.
|
|
739
|
+
* - `"absent-echo"`: the provider omitted `scope`, so the grant equals what was
|
|
740
|
+
* requested (RFC 6749 §5.1) and the seam unions the requested set. Resolved
|
|
741
|
+
* at runtime by the persistence seam, never declared by a provider.
|
|
742
|
+
*
|
|
743
|
+
* @see https://www.rfc-editor.org/rfc/rfc6749#section-5.1
|
|
744
|
+
*/
|
|
745
|
+
type GrantAuthority = "full-grant" | "projection" | "absent-echo";
|
|
746
|
+
/**
|
|
747
|
+
* The authority a provider may declare for its own echoed scope. `"absent-echo"`
|
|
748
|
+
* is excluded because it is a runtime condition (an omitted echo), not a
|
|
749
|
+
* provider trait.
|
|
750
|
+
*/
|
|
751
|
+
type ProviderGrantAuthority = Exclude<GrantAuthority, "absent-echo">;
|
|
752
|
+
interface UpstreamProvider<T extends Record<string, any> = Record<string, any>, O extends Record<string, any> = Partial<ProviderOptions>> {
|
|
669
753
|
id: LiteralString;
|
|
754
|
+
/**
|
|
755
|
+
* The path the provider redirects back to, relative to the app base URL,
|
|
756
|
+
* e.g. `/callback/google`.
|
|
757
|
+
*/
|
|
758
|
+
callbackPath: string;
|
|
759
|
+
/**
|
|
760
|
+
* How the persistence seam treats this provider's echoed token-response
|
|
761
|
+
* `scope`. Declare `"full-grant"` only when the echo is the user's complete
|
|
762
|
+
* current grant (e.g. Google with `include_granted_scopes`); otherwise the
|
|
763
|
+
* echo is unioned onto the stored grant.
|
|
764
|
+
*
|
|
765
|
+
* @default "projection"
|
|
766
|
+
*/
|
|
767
|
+
grantAuthority?: ProviderGrantAuthority | undefined;
|
|
670
768
|
createAuthorizationURL: (data: {
|
|
671
769
|
state: string;
|
|
672
770
|
codeVerifier: string;
|
|
@@ -681,7 +779,7 @@ interface OAuthProvider<T extends Record<string, any> = Record<string, any>, O e
|
|
|
681
779
|
* before applying them.
|
|
682
780
|
*/
|
|
683
781
|
additionalParams?: Record<string, string> | undefined;
|
|
684
|
-
}) => Awaitable<
|
|
782
|
+
}) => Awaitable<AuthorizationURLResult>;
|
|
685
783
|
name: string;
|
|
686
784
|
validateAuthorizationCode: (data: {
|
|
687
785
|
code: string;
|
|
@@ -709,14 +807,12 @@ interface OAuthProvider<T extends Record<string, any> = Record<string, any>, O e
|
|
|
709
807
|
* Custom function to refresh a token
|
|
710
808
|
*/
|
|
711
809
|
refreshAccessToken?: ((refreshToken: string) => Promise<OAuth2Tokens>) | undefined;
|
|
712
|
-
revokeToken?: ((token: string) => Promise<void>) | undefined;
|
|
713
810
|
/**
|
|
714
|
-
*
|
|
715
|
-
*
|
|
716
|
-
*
|
|
717
|
-
* @returns True if the id token is valid, false otherwise
|
|
811
|
+
* Declarative id_token verification config consumed by the shared
|
|
812
|
+
* `verifyProviderIdToken` verifier. Providers set this instead of implementing a boolean
|
|
813
|
+
* verify method, which keeps verification centralized and fail-closed.
|
|
718
814
|
*/
|
|
719
|
-
|
|
815
|
+
idToken?: OAuthIdTokenConfig | undefined;
|
|
720
816
|
/**
|
|
721
817
|
* The expected issuer identifier for this provider (RFC 9207).
|
|
722
818
|
* When set, the callback handler validates the `iss` query parameter
|
|
@@ -856,6 +952,29 @@ type ProviderOptions<Profile extends Record<string, any> = any> = {
|
|
|
856
952
|
* @default false
|
|
857
953
|
*/
|
|
858
954
|
overrideUserInfoOnSignIn?: boolean | undefined;
|
|
955
|
+
/**
|
|
956
|
+
* Require this provider's email to be verified before a session is created.
|
|
957
|
+
*
|
|
958
|
+
* When the provider reports the email as unverified, the user and account are
|
|
959
|
+
* still created/linked, but no session is issued: the OAuth callback redirects
|
|
960
|
+
* with `?error=email_not_verified` and id-token sign-in returns a `403`
|
|
961
|
+
* `EMAIL_NOT_VERIFIED`. A verification email is (re)sent per the
|
|
962
|
+
* `emailVerification` settings (`sendOnSignUp` / `sendOnSignIn`).
|
|
963
|
+
*
|
|
964
|
+
* The gate checks the local user's verification state, not the provider's
|
|
965
|
+
* claim on each request: a user already verified through another method (or a
|
|
966
|
+
* prior verified sign-in) keeps access even if the provider later reports the
|
|
967
|
+
* email as unverified.
|
|
968
|
+
*
|
|
969
|
+
* This is opt-in per provider and is independent of
|
|
970
|
+
* `emailAndPassword.requireEmailVerification`; enabling that does not gate
|
|
971
|
+
* social sign-in. Only enable it for providers that report a trustworthy
|
|
972
|
+
* `email_verified` signal: several providers always report the email as
|
|
973
|
+
* unverified, which would block every sign-in.
|
|
974
|
+
*
|
|
975
|
+
* @default false
|
|
976
|
+
*/
|
|
977
|
+
requireEmailVerification?: boolean | undefined;
|
|
859
978
|
}; //#endregion
|
|
860
979
|
//#endregion
|
|
861
980
|
//#region ../core/dist/social-providers/apple.d.mts
|
|
@@ -1164,6 +1283,15 @@ interface GithubOptions extends ProviderOptions<GithubProfile> {
|
|
|
1164
1283
|
clientId: string;
|
|
1165
1284
|
}
|
|
1166
1285
|
//#endregion
|
|
1286
|
+
//#region ../core/dist/oauth2/client-assertion.d.mts
|
|
1287
|
+
type ClientAssertionGrantType = "authorization_code" | "refresh_token" | "client_credentials";
|
|
1288
|
+
interface ClientAssertionContext {
|
|
1289
|
+
clientId: string;
|
|
1290
|
+
tokenEndpoint: string;
|
|
1291
|
+
grantType: ClientAssertionGrantType;
|
|
1292
|
+
}
|
|
1293
|
+
type ClientAssertionGetter = (context: ClientAssertionContext) => Awaitable<string>;
|
|
1294
|
+
//#endregion
|
|
1167
1295
|
//#region ../core/dist/social-providers/microsoft-entra-id.d.mts
|
|
1168
1296
|
//#region src/social-providers/microsoft-entra-id.d.ts
|
|
1169
1297
|
/**
|
|
@@ -1275,21 +1403,29 @@ interface MicrosoftOptions extends ProviderOptions<MicrosoftEntraIDProfile> {
|
|
|
1275
1403
|
* The tenant ID of the Microsoft account
|
|
1276
1404
|
* @default "common"
|
|
1277
1405
|
*/
|
|
1278
|
-
tenantId?: string
|
|
1406
|
+
tenantId?: string;
|
|
1279
1407
|
/**
|
|
1280
1408
|
* The authentication authority URL. Use the default "https://login.microsoftonline.com" for standard Entra ID or "https://<tenant-id>.ciamlogin.com" for CIAM scenarios.
|
|
1281
1409
|
* @default "https://login.microsoftonline.com"
|
|
1282
1410
|
*/
|
|
1283
|
-
authority?: string
|
|
1411
|
+
authority?: string;
|
|
1412
|
+
/**
|
|
1413
|
+
* Function that returns a JWT client assertion for token endpoint authentication.
|
|
1414
|
+
*
|
|
1415
|
+
* Use this instead of `clientSecret` when your Microsoft Entra ID app is
|
|
1416
|
+
* configured for client authentication with assertions (private_key_jwt or
|
|
1417
|
+
* workload identity federation).
|
|
1418
|
+
*/
|
|
1419
|
+
clientAssertion?: ClientAssertionGetter;
|
|
1284
1420
|
/**
|
|
1285
1421
|
* The size of the profile photo
|
|
1286
1422
|
* @default 48
|
|
1287
1423
|
*/
|
|
1288
|
-
profilePhotoSize?:
|
|
1424
|
+
profilePhotoSize?: 48 | 64 | 96 | 120 | 240 | 360 | 432 | 504 | 648;
|
|
1289
1425
|
/**
|
|
1290
1426
|
* Disable profile photo
|
|
1291
1427
|
*/
|
|
1292
|
-
disableProfilePhoto?: boolean
|
|
1428
|
+
disableProfilePhoto?: boolean;
|
|
1293
1429
|
}
|
|
1294
1430
|
//#endregion
|
|
1295
1431
|
//#region ../core/dist/social-providers/google.d.mts
|
|
@@ -1331,9 +1467,22 @@ interface GoogleOptions extends ProviderOptions<GoogleProfile> {
|
|
|
1331
1467
|
*/
|
|
1332
1468
|
display?: ("page" | "popup" | "touch" | "wap") | undefined;
|
|
1333
1469
|
/**
|
|
1334
|
-
* The hosted domain
|
|
1470
|
+
* The hosted domain (Google Workspace) the user must belong to.
|
|
1471
|
+
*
|
|
1472
|
+
* This is sent to Google as the `hd` authorization hint and, when set, is
|
|
1473
|
+
* also enforced against the `hd` claim of the returned id token/profile.
|
|
1474
|
+
* Sign-in is rejected when the claim is missing or does not match, so this
|
|
1475
|
+
* can be used to restrict sign-in to a Workspace domain.
|
|
1335
1476
|
*/
|
|
1336
1477
|
hd?: string | undefined;
|
|
1478
|
+
/**
|
|
1479
|
+
* Enable incremental authorization via Google's `include_granted_scopes`
|
|
1480
|
+
* parameter. When enabled, Google reports the user's full granted scope set
|
|
1481
|
+
* in the token response.
|
|
1482
|
+
*
|
|
1483
|
+
* @default true
|
|
1484
|
+
*/
|
|
1485
|
+
includeGrantedScopes?: boolean | undefined;
|
|
1337
1486
|
}
|
|
1338
1487
|
//#endregion
|
|
1339
1488
|
//#region ../core/dist/social-providers/huggingface.d.mts
|
|
@@ -2204,6 +2353,7 @@ declare const socialProviders: {
|
|
|
2204
2353
|
apple: (options: AppleOptions) => {
|
|
2205
2354
|
id: "apple";
|
|
2206
2355
|
name: string;
|
|
2356
|
+
callbackPath: string;
|
|
2207
2357
|
createAuthorizationURL({
|
|
2208
2358
|
state,
|
|
2209
2359
|
scopes,
|
|
@@ -2217,7 +2367,10 @@ declare const socialProviders: {
|
|
|
2217
2367
|
display?: string | undefined;
|
|
2218
2368
|
loginHint?: string | undefined;
|
|
2219
2369
|
additionalParams?: Record<string, string> | undefined;
|
|
2220
|
-
}): Promise<
|
|
2370
|
+
}): Promise<{
|
|
2371
|
+
url: URL;
|
|
2372
|
+
requestedScopes: string[];
|
|
2373
|
+
}>;
|
|
2221
2374
|
validateAuthorizationCode: ({
|
|
2222
2375
|
code,
|
|
2223
2376
|
codeVerifier,
|
|
@@ -2228,7 +2381,13 @@ declare const socialProviders: {
|
|
|
2228
2381
|
codeVerifier?: string | undefined;
|
|
2229
2382
|
deviceId?: string | undefined;
|
|
2230
2383
|
}) => Promise<OAuth2Tokens>;
|
|
2231
|
-
|
|
2384
|
+
idToken: {
|
|
2385
|
+
jwks: (header: jose.JWTHeaderParameters) => Promise<Uint8Array<ArrayBufferLike> | CryptoKey>;
|
|
2386
|
+
issuer: string;
|
|
2387
|
+
audience: string | string[];
|
|
2388
|
+
maxTokenAge: string;
|
|
2389
|
+
nonceComparison: "exact-or-sha256";
|
|
2390
|
+
};
|
|
2232
2391
|
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
|
|
2233
2392
|
getUserInfo(token: OAuth2Tokens & {
|
|
2234
2393
|
user?: {
|
|
@@ -2254,6 +2413,7 @@ declare const socialProviders: {
|
|
|
2254
2413
|
atlassian: (options: AtlassianOptions) => {
|
|
2255
2414
|
id: "atlassian";
|
|
2256
2415
|
name: string;
|
|
2416
|
+
callbackPath: string;
|
|
2257
2417
|
createAuthorizationURL({
|
|
2258
2418
|
state,
|
|
2259
2419
|
scopes,
|
|
@@ -2268,7 +2428,10 @@ declare const socialProviders: {
|
|
|
2268
2428
|
display?: string | undefined;
|
|
2269
2429
|
loginHint?: string | undefined;
|
|
2270
2430
|
additionalParams?: Record<string, string> | undefined;
|
|
2271
|
-
}): Promise<
|
|
2431
|
+
}): Promise<{
|
|
2432
|
+
url: URL;
|
|
2433
|
+
requestedScopes: string[];
|
|
2434
|
+
}>;
|
|
2272
2435
|
validateAuthorizationCode: ({
|
|
2273
2436
|
code,
|
|
2274
2437
|
codeVerifier,
|
|
@@ -2304,6 +2467,7 @@ declare const socialProviders: {
|
|
|
2304
2467
|
cognito: (options: CognitoOptions) => {
|
|
2305
2468
|
id: "cognito";
|
|
2306
2469
|
name: string;
|
|
2470
|
+
callbackPath: string;
|
|
2307
2471
|
createAuthorizationURL({
|
|
2308
2472
|
state,
|
|
2309
2473
|
scopes,
|
|
@@ -2318,7 +2482,10 @@ declare const socialProviders: {
|
|
|
2318
2482
|
display?: string | undefined;
|
|
2319
2483
|
loginHint?: string | undefined;
|
|
2320
2484
|
additionalParams?: Record<string, string> | undefined;
|
|
2321
|
-
}): Promise<
|
|
2485
|
+
}): Promise<{
|
|
2486
|
+
url: URL;
|
|
2487
|
+
requestedScopes: string[];
|
|
2488
|
+
}>;
|
|
2322
2489
|
validateAuthorizationCode: ({
|
|
2323
2490
|
code,
|
|
2324
2491
|
codeVerifier,
|
|
@@ -2330,7 +2497,12 @@ declare const socialProviders: {
|
|
|
2330
2497
|
deviceId?: string | undefined;
|
|
2331
2498
|
}) => Promise<OAuth2Tokens>;
|
|
2332
2499
|
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
|
|
2333
|
-
|
|
2500
|
+
idToken: {
|
|
2501
|
+
jwks: (header: jose.JWTHeaderParameters) => Promise<Uint8Array<ArrayBufferLike> | CryptoKey>;
|
|
2502
|
+
issuer: string;
|
|
2503
|
+
audience: string | string[];
|
|
2504
|
+
maxTokenAge: string;
|
|
2505
|
+
};
|
|
2334
2506
|
getUserInfo(token: OAuth2Tokens & {
|
|
2335
2507
|
user?: {
|
|
2336
2508
|
name?: {
|
|
@@ -2355,6 +2527,7 @@ declare const socialProviders: {
|
|
|
2355
2527
|
discord: (options: DiscordOptions) => {
|
|
2356
2528
|
id: "discord";
|
|
2357
2529
|
name: string;
|
|
2530
|
+
callbackPath: string;
|
|
2358
2531
|
createAuthorizationURL({
|
|
2359
2532
|
state,
|
|
2360
2533
|
scopes,
|
|
@@ -2368,7 +2541,10 @@ declare const socialProviders: {
|
|
|
2368
2541
|
display?: string | undefined;
|
|
2369
2542
|
loginHint?: string | undefined;
|
|
2370
2543
|
additionalParams?: Record<string, string> | undefined;
|
|
2371
|
-
}): Promise<
|
|
2544
|
+
}): Promise<{
|
|
2545
|
+
url: URL;
|
|
2546
|
+
requestedScopes: string[];
|
|
2547
|
+
}>;
|
|
2372
2548
|
validateAuthorizationCode: ({
|
|
2373
2549
|
code,
|
|
2374
2550
|
redirectURI
|
|
@@ -2403,6 +2579,7 @@ declare const socialProviders: {
|
|
|
2403
2579
|
facebook: (options: FacebookOptions) => {
|
|
2404
2580
|
id: "facebook";
|
|
2405
2581
|
name: string;
|
|
2582
|
+
callbackPath: string;
|
|
2406
2583
|
createAuthorizationURL({
|
|
2407
2584
|
state,
|
|
2408
2585
|
scopes,
|
|
@@ -2417,7 +2594,10 @@ declare const socialProviders: {
|
|
|
2417
2594
|
display?: string | undefined;
|
|
2418
2595
|
loginHint?: string | undefined;
|
|
2419
2596
|
additionalParams?: Record<string, string> | undefined;
|
|
2420
|
-
}): Promise<
|
|
2597
|
+
}): Promise<{
|
|
2598
|
+
url: URL;
|
|
2599
|
+
requestedScopes: string[];
|
|
2600
|
+
}>;
|
|
2421
2601
|
validateAuthorizationCode: ({
|
|
2422
2602
|
code,
|
|
2423
2603
|
redirectURI
|
|
@@ -2427,7 +2607,20 @@ declare const socialProviders: {
|
|
|
2427
2607
|
codeVerifier?: string | undefined;
|
|
2428
2608
|
deviceId?: string | undefined;
|
|
2429
2609
|
}) => Promise<OAuth2Tokens>;
|
|
2430
|
-
|
|
2610
|
+
idToken: {
|
|
2611
|
+
jwks: {
|
|
2612
|
+
(protectedHeader?: jose.JWSHeaderParameters, token?: jose.FlattenedJWSInput): Promise<jose.CryptoKey>;
|
|
2613
|
+
coolingDown: boolean;
|
|
2614
|
+
fresh: boolean;
|
|
2615
|
+
reloading: boolean;
|
|
2616
|
+
reload: () => Promise<void>;
|
|
2617
|
+
jwks: () => jose.JSONWebKeySet | undefined;
|
|
2618
|
+
};
|
|
2619
|
+
issuer: string;
|
|
2620
|
+
audience: string | string[];
|
|
2621
|
+
algorithms: string[];
|
|
2622
|
+
allowOpaqueToken: true;
|
|
2623
|
+
};
|
|
2431
2624
|
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
|
|
2432
2625
|
getUserInfo(token: OAuth2Tokens & {
|
|
2433
2626
|
user?: {
|
|
@@ -2453,6 +2646,7 @@ declare const socialProviders: {
|
|
|
2453
2646
|
figma: (options: FigmaOptions) => {
|
|
2454
2647
|
id: "figma";
|
|
2455
2648
|
name: string;
|
|
2649
|
+
callbackPath: string;
|
|
2456
2650
|
createAuthorizationURL({
|
|
2457
2651
|
state,
|
|
2458
2652
|
scopes,
|
|
@@ -2467,7 +2661,10 @@ declare const socialProviders: {
|
|
|
2467
2661
|
display?: string | undefined;
|
|
2468
2662
|
loginHint?: string | undefined;
|
|
2469
2663
|
additionalParams?: Record<string, string> | undefined;
|
|
2470
|
-
}): Promise<
|
|
2664
|
+
}): Promise<{
|
|
2665
|
+
url: URL;
|
|
2666
|
+
requestedScopes: string[];
|
|
2667
|
+
}>;
|
|
2471
2668
|
validateAuthorizationCode: ({
|
|
2472
2669
|
code,
|
|
2473
2670
|
codeVerifier,
|
|
@@ -2503,6 +2700,7 @@ declare const socialProviders: {
|
|
|
2503
2700
|
github: (options: GithubOptions) => {
|
|
2504
2701
|
id: "github";
|
|
2505
2702
|
name: string;
|
|
2703
|
+
callbackPath: string;
|
|
2506
2704
|
createAuthorizationURL({
|
|
2507
2705
|
state,
|
|
2508
2706
|
scopes,
|
|
@@ -2518,7 +2716,10 @@ declare const socialProviders: {
|
|
|
2518
2716
|
display?: string | undefined;
|
|
2519
2717
|
loginHint?: string | undefined;
|
|
2520
2718
|
additionalParams?: Record<string, string> | undefined;
|
|
2521
|
-
}): Promise<
|
|
2719
|
+
}): Promise<{
|
|
2720
|
+
url: URL;
|
|
2721
|
+
requestedScopes: string[];
|
|
2722
|
+
}>;
|
|
2522
2723
|
validateAuthorizationCode: ({
|
|
2523
2724
|
code,
|
|
2524
2725
|
codeVerifier,
|
|
@@ -2554,6 +2755,7 @@ declare const socialProviders: {
|
|
|
2554
2755
|
microsoft: (options: MicrosoftOptions) => {
|
|
2555
2756
|
id: "microsoft";
|
|
2556
2757
|
name: string;
|
|
2758
|
+
callbackPath: string;
|
|
2557
2759
|
createAuthorizationURL(data: {
|
|
2558
2760
|
state: string;
|
|
2559
2761
|
codeVerifier: string;
|
|
@@ -2562,7 +2764,10 @@ declare const socialProviders: {
|
|
|
2562
2764
|
display?: string | undefined;
|
|
2563
2765
|
loginHint?: string | undefined;
|
|
2564
2766
|
additionalParams?: Record<string, string> | undefined;
|
|
2565
|
-
}): Promise<
|
|
2767
|
+
}): Promise<{
|
|
2768
|
+
url: URL;
|
|
2769
|
+
requestedScopes: string[];
|
|
2770
|
+
}>;
|
|
2566
2771
|
validateAuthorizationCode({
|
|
2567
2772
|
code,
|
|
2568
2773
|
codeVerifier,
|
|
@@ -2573,7 +2778,12 @@ declare const socialProviders: {
|
|
|
2573
2778
|
codeVerifier?: string | undefined;
|
|
2574
2779
|
deviceId?: string | undefined;
|
|
2575
2780
|
}): Promise<OAuth2Tokens>;
|
|
2576
|
-
|
|
2781
|
+
idToken: {
|
|
2782
|
+
jwks: (header: jose.JWTHeaderParameters) => Promise<Uint8Array<ArrayBufferLike> | CryptoKey>;
|
|
2783
|
+
audience: string | string[];
|
|
2784
|
+
maxTokenAge: string;
|
|
2785
|
+
issuer: string | undefined;
|
|
2786
|
+
};
|
|
2577
2787
|
getUserInfo(token: OAuth2Tokens & {
|
|
2578
2788
|
user?: {
|
|
2579
2789
|
name?: {
|
|
@@ -2599,6 +2809,8 @@ declare const socialProviders: {
|
|
|
2599
2809
|
google: (options: GoogleOptions) => {
|
|
2600
2810
|
id: "google";
|
|
2601
2811
|
name: string;
|
|
2812
|
+
callbackPath: string;
|
|
2813
|
+
grantAuthority: "full-grant" | "projection";
|
|
2602
2814
|
createAuthorizationURL({
|
|
2603
2815
|
state,
|
|
2604
2816
|
scopes,
|
|
@@ -2615,7 +2827,10 @@ declare const socialProviders: {
|
|
|
2615
2827
|
display?: string | undefined;
|
|
2616
2828
|
loginHint?: string | undefined;
|
|
2617
2829
|
additionalParams?: Record<string, string> | undefined;
|
|
2618
|
-
}): Promise<
|
|
2830
|
+
}): Promise<{
|
|
2831
|
+
url: URL;
|
|
2832
|
+
requestedScopes: string[];
|
|
2833
|
+
}>;
|
|
2619
2834
|
validateAuthorizationCode: ({
|
|
2620
2835
|
code,
|
|
2621
2836
|
codeVerifier,
|
|
@@ -2627,7 +2842,13 @@ declare const socialProviders: {
|
|
|
2627
2842
|
deviceId?: string | undefined;
|
|
2628
2843
|
}) => Promise<OAuth2Tokens>;
|
|
2629
2844
|
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
|
|
2630
|
-
|
|
2845
|
+
idToken: {
|
|
2846
|
+
jwks: (header: jose.JWTHeaderParameters) => Promise<Uint8Array<ArrayBufferLike> | CryptoKey>;
|
|
2847
|
+
issuer: string[];
|
|
2848
|
+
audience: string | string[];
|
|
2849
|
+
maxTokenAge: string;
|
|
2850
|
+
verifyClaims: ((claims: Record<string, unknown>) => boolean) | undefined;
|
|
2851
|
+
};
|
|
2631
2852
|
getUserInfo(token: OAuth2Tokens & {
|
|
2632
2853
|
user?: {
|
|
2633
2854
|
name?: {
|
|
@@ -2652,6 +2873,7 @@ declare const socialProviders: {
|
|
|
2652
2873
|
huggingface: (options: HuggingFaceOptions) => {
|
|
2653
2874
|
id: "huggingface";
|
|
2654
2875
|
name: string;
|
|
2876
|
+
callbackPath: string;
|
|
2655
2877
|
createAuthorizationURL({
|
|
2656
2878
|
state,
|
|
2657
2879
|
scopes,
|
|
@@ -2666,7 +2888,10 @@ declare const socialProviders: {
|
|
|
2666
2888
|
display?: string | undefined;
|
|
2667
2889
|
loginHint?: string | undefined;
|
|
2668
2890
|
additionalParams?: Record<string, string> | undefined;
|
|
2669
|
-
}): Promise<
|
|
2891
|
+
}): Promise<{
|
|
2892
|
+
url: URL;
|
|
2893
|
+
requestedScopes: string[];
|
|
2894
|
+
}>;
|
|
2670
2895
|
validateAuthorizationCode: ({
|
|
2671
2896
|
code,
|
|
2672
2897
|
codeVerifier,
|
|
@@ -2702,6 +2927,7 @@ declare const socialProviders: {
|
|
|
2702
2927
|
slack: (options: SlackOptions) => {
|
|
2703
2928
|
id: "slack";
|
|
2704
2929
|
name: string;
|
|
2930
|
+
callbackPath: string;
|
|
2705
2931
|
createAuthorizationURL({
|
|
2706
2932
|
state,
|
|
2707
2933
|
scopes,
|
|
@@ -2715,7 +2941,10 @@ declare const socialProviders: {
|
|
|
2715
2941
|
display?: string | undefined;
|
|
2716
2942
|
loginHint?: string | undefined;
|
|
2717
2943
|
additionalParams?: Record<string, string> | undefined;
|
|
2718
|
-
}): Promise<
|
|
2944
|
+
}): Promise<{
|
|
2945
|
+
url: URL;
|
|
2946
|
+
requestedScopes: string[];
|
|
2947
|
+
}>;
|
|
2719
2948
|
validateAuthorizationCode: ({
|
|
2720
2949
|
code,
|
|
2721
2950
|
redirectURI
|
|
@@ -2750,6 +2979,7 @@ declare const socialProviders: {
|
|
|
2750
2979
|
spotify: (options: SpotifyOptions) => {
|
|
2751
2980
|
id: "spotify";
|
|
2752
2981
|
name: string;
|
|
2982
|
+
callbackPath: string;
|
|
2753
2983
|
createAuthorizationURL({
|
|
2754
2984
|
state,
|
|
2755
2985
|
scopes,
|
|
@@ -2764,7 +2994,10 @@ declare const socialProviders: {
|
|
|
2764
2994
|
display?: string | undefined;
|
|
2765
2995
|
loginHint?: string | undefined;
|
|
2766
2996
|
additionalParams?: Record<string, string> | undefined;
|
|
2767
|
-
}): Promise<
|
|
2997
|
+
}): Promise<{
|
|
2998
|
+
url: URL;
|
|
2999
|
+
requestedScopes: string[];
|
|
3000
|
+
}>;
|
|
2768
3001
|
validateAuthorizationCode: ({
|
|
2769
3002
|
code,
|
|
2770
3003
|
codeVerifier,
|
|
@@ -2800,6 +3033,7 @@ declare const socialProviders: {
|
|
|
2800
3033
|
twitch: (options: TwitchOptions) => {
|
|
2801
3034
|
id: "twitch";
|
|
2802
3035
|
name: string;
|
|
3036
|
+
callbackPath: string;
|
|
2803
3037
|
createAuthorizationURL({
|
|
2804
3038
|
state,
|
|
2805
3039
|
scopes,
|
|
@@ -2813,7 +3047,10 @@ declare const socialProviders: {
|
|
|
2813
3047
|
display?: string | undefined;
|
|
2814
3048
|
loginHint?: string | undefined;
|
|
2815
3049
|
additionalParams?: Record<string, string> | undefined;
|
|
2816
|
-
}): Promise<
|
|
3050
|
+
}): Promise<{
|
|
3051
|
+
url: URL;
|
|
3052
|
+
requestedScopes: string[];
|
|
3053
|
+
}>;
|
|
2817
3054
|
validateAuthorizationCode: ({
|
|
2818
3055
|
code,
|
|
2819
3056
|
redirectURI
|
|
@@ -2848,6 +3085,7 @@ declare const socialProviders: {
|
|
|
2848
3085
|
twitter: (options: TwitterOption) => {
|
|
2849
3086
|
id: "twitter";
|
|
2850
3087
|
name: string;
|
|
3088
|
+
callbackPath: string;
|
|
2851
3089
|
createAuthorizationURL(data: {
|
|
2852
3090
|
state: string;
|
|
2853
3091
|
codeVerifier: string;
|
|
@@ -2856,7 +3094,10 @@ declare const socialProviders: {
|
|
|
2856
3094
|
display?: string | undefined;
|
|
2857
3095
|
loginHint?: string | undefined;
|
|
2858
3096
|
additionalParams?: Record<string, string> | undefined;
|
|
2859
|
-
}): Promise<
|
|
3097
|
+
}): Promise<{
|
|
3098
|
+
url: URL;
|
|
3099
|
+
requestedScopes: string[];
|
|
3100
|
+
}>;
|
|
2860
3101
|
validateAuthorizationCode: ({
|
|
2861
3102
|
code,
|
|
2862
3103
|
codeVerifier,
|
|
@@ -2892,6 +3133,7 @@ declare const socialProviders: {
|
|
|
2892
3133
|
dropbox: (options: DropboxOptions) => {
|
|
2893
3134
|
id: "dropbox";
|
|
2894
3135
|
name: string;
|
|
3136
|
+
callbackPath: string;
|
|
2895
3137
|
createAuthorizationURL: ({
|
|
2896
3138
|
state,
|
|
2897
3139
|
scopes,
|
|
@@ -2906,7 +3148,10 @@ declare const socialProviders: {
|
|
|
2906
3148
|
display?: string | undefined;
|
|
2907
3149
|
loginHint?: string | undefined;
|
|
2908
3150
|
additionalParams?: Record<string, string> | undefined;
|
|
2909
|
-
}) => Promise<
|
|
3151
|
+
}) => Promise<{
|
|
3152
|
+
url: URL;
|
|
3153
|
+
requestedScopes: string[];
|
|
3154
|
+
}>;
|
|
2910
3155
|
validateAuthorizationCode: ({
|
|
2911
3156
|
code,
|
|
2912
3157
|
codeVerifier,
|
|
@@ -2942,6 +3187,7 @@ declare const socialProviders: {
|
|
|
2942
3187
|
kick: (options: KickOptions) => {
|
|
2943
3188
|
id: "kick";
|
|
2944
3189
|
name: string;
|
|
3190
|
+
callbackPath: string;
|
|
2945
3191
|
createAuthorizationURL({
|
|
2946
3192
|
state,
|
|
2947
3193
|
scopes,
|
|
@@ -2956,7 +3202,10 @@ declare const socialProviders: {
|
|
|
2956
3202
|
display?: string | undefined;
|
|
2957
3203
|
loginHint?: string | undefined;
|
|
2958
3204
|
additionalParams?: Record<string, string> | undefined;
|
|
2959
|
-
}): Promise<
|
|
3205
|
+
}): Promise<{
|
|
3206
|
+
url: URL;
|
|
3207
|
+
requestedScopes: string[];
|
|
3208
|
+
}>;
|
|
2960
3209
|
validateAuthorizationCode({
|
|
2961
3210
|
code,
|
|
2962
3211
|
redirectURI,
|
|
@@ -2992,6 +3241,7 @@ declare const socialProviders: {
|
|
|
2992
3241
|
linear: (options: LinearOptions) => {
|
|
2993
3242
|
id: "linear";
|
|
2994
3243
|
name: string;
|
|
3244
|
+
callbackPath: string;
|
|
2995
3245
|
createAuthorizationURL({
|
|
2996
3246
|
state,
|
|
2997
3247
|
scopes,
|
|
@@ -3006,7 +3256,10 @@ declare const socialProviders: {
|
|
|
3006
3256
|
display?: string | undefined;
|
|
3007
3257
|
loginHint?: string | undefined;
|
|
3008
3258
|
additionalParams?: Record<string, string> | undefined;
|
|
3009
|
-
}): Promise<
|
|
3259
|
+
}): Promise<{
|
|
3260
|
+
url: URL;
|
|
3261
|
+
requestedScopes: string[];
|
|
3262
|
+
}>;
|
|
3010
3263
|
validateAuthorizationCode: ({
|
|
3011
3264
|
code,
|
|
3012
3265
|
redirectURI
|
|
@@ -3041,6 +3294,7 @@ declare const socialProviders: {
|
|
|
3041
3294
|
linkedin: (options: LinkedInOptions) => {
|
|
3042
3295
|
id: "linkedin";
|
|
3043
3296
|
name: string;
|
|
3297
|
+
callbackPath: string;
|
|
3044
3298
|
createAuthorizationURL: ({
|
|
3045
3299
|
state,
|
|
3046
3300
|
scopes,
|
|
@@ -3055,7 +3309,10 @@ declare const socialProviders: {
|
|
|
3055
3309
|
display?: string | undefined;
|
|
3056
3310
|
loginHint?: string | undefined;
|
|
3057
3311
|
additionalParams?: Record<string, string> | undefined;
|
|
3058
|
-
}) => Promise<
|
|
3312
|
+
}) => Promise<{
|
|
3313
|
+
url: URL;
|
|
3314
|
+
requestedScopes: string[];
|
|
3315
|
+
}>;
|
|
3059
3316
|
validateAuthorizationCode: ({
|
|
3060
3317
|
code,
|
|
3061
3318
|
redirectURI
|
|
@@ -3090,6 +3347,7 @@ declare const socialProviders: {
|
|
|
3090
3347
|
gitlab: (options: GitlabOptions) => {
|
|
3091
3348
|
id: "gitlab";
|
|
3092
3349
|
name: string;
|
|
3350
|
+
callbackPath: string;
|
|
3093
3351
|
createAuthorizationURL: ({
|
|
3094
3352
|
state,
|
|
3095
3353
|
scopes,
|
|
@@ -3105,7 +3363,10 @@ declare const socialProviders: {
|
|
|
3105
3363
|
display?: string | undefined;
|
|
3106
3364
|
loginHint?: string | undefined;
|
|
3107
3365
|
additionalParams?: Record<string, string> | undefined;
|
|
3108
|
-
}) => Promise<
|
|
3366
|
+
}) => Promise<{
|
|
3367
|
+
url: URL;
|
|
3368
|
+
requestedScopes: string[];
|
|
3369
|
+
}>;
|
|
3109
3370
|
validateAuthorizationCode: ({
|
|
3110
3371
|
code,
|
|
3111
3372
|
redirectURI,
|
|
@@ -3162,6 +3423,7 @@ declare const socialProviders: {
|
|
|
3162
3423
|
tiktok: (options: TiktokOptions) => {
|
|
3163
3424
|
id: "tiktok";
|
|
3164
3425
|
name: string;
|
|
3426
|
+
callbackPath: string;
|
|
3165
3427
|
createAuthorizationURL({
|
|
3166
3428
|
state,
|
|
3167
3429
|
scopes,
|
|
@@ -3175,7 +3437,10 @@ declare const socialProviders: {
|
|
|
3175
3437
|
display?: string | undefined;
|
|
3176
3438
|
loginHint?: string | undefined;
|
|
3177
3439
|
additionalParams?: Record<string, string> | undefined;
|
|
3178
|
-
}):
|
|
3440
|
+
}): {
|
|
3441
|
+
url: URL;
|
|
3442
|
+
requestedScopes: string[];
|
|
3443
|
+
};
|
|
3179
3444
|
validateAuthorizationCode: ({
|
|
3180
3445
|
code,
|
|
3181
3446
|
redirectURI
|
|
@@ -3210,6 +3475,7 @@ declare const socialProviders: {
|
|
|
3210
3475
|
reddit: (options: RedditOptions) => {
|
|
3211
3476
|
id: "reddit";
|
|
3212
3477
|
name: string;
|
|
3478
|
+
callbackPath: string;
|
|
3213
3479
|
createAuthorizationURL({
|
|
3214
3480
|
state,
|
|
3215
3481
|
scopes,
|
|
@@ -3223,7 +3489,10 @@ declare const socialProviders: {
|
|
|
3223
3489
|
display?: string | undefined;
|
|
3224
3490
|
loginHint?: string | undefined;
|
|
3225
3491
|
additionalParams?: Record<string, string> | undefined;
|
|
3226
|
-
}): Promise<
|
|
3492
|
+
}): Promise<{
|
|
3493
|
+
url: URL;
|
|
3494
|
+
requestedScopes: string[];
|
|
3495
|
+
}>;
|
|
3227
3496
|
validateAuthorizationCode: ({
|
|
3228
3497
|
code,
|
|
3229
3498
|
redirectURI
|
|
@@ -3258,6 +3527,7 @@ declare const socialProviders: {
|
|
|
3258
3527
|
roblox: (options: RobloxOptions) => {
|
|
3259
3528
|
id: "roblox";
|
|
3260
3529
|
name: string;
|
|
3530
|
+
callbackPath: string;
|
|
3261
3531
|
createAuthorizationURL({
|
|
3262
3532
|
state,
|
|
3263
3533
|
scopes,
|
|
@@ -3271,7 +3541,10 @@ declare const socialProviders: {
|
|
|
3271
3541
|
display?: string | undefined;
|
|
3272
3542
|
loginHint?: string | undefined;
|
|
3273
3543
|
additionalParams?: Record<string, string> | undefined;
|
|
3274
|
-
}): Promise<
|
|
3544
|
+
}): Promise<{
|
|
3545
|
+
url: URL;
|
|
3546
|
+
requestedScopes: string[];
|
|
3547
|
+
}>;
|
|
3275
3548
|
validateAuthorizationCode: ({
|
|
3276
3549
|
code,
|
|
3277
3550
|
redirectURI
|
|
@@ -3306,6 +3579,7 @@ declare const socialProviders: {
|
|
|
3306
3579
|
salesforce: (options: SalesforceOptions) => {
|
|
3307
3580
|
id: "salesforce";
|
|
3308
3581
|
name: string;
|
|
3582
|
+
callbackPath: string;
|
|
3309
3583
|
createAuthorizationURL({
|
|
3310
3584
|
state,
|
|
3311
3585
|
scopes,
|
|
@@ -3320,7 +3594,10 @@ declare const socialProviders: {
|
|
|
3320
3594
|
display?: string | undefined;
|
|
3321
3595
|
loginHint?: string | undefined;
|
|
3322
3596
|
additionalParams?: Record<string, string> | undefined;
|
|
3323
|
-
}): Promise<
|
|
3597
|
+
}): Promise<{
|
|
3598
|
+
url: URL;
|
|
3599
|
+
requestedScopes: string[];
|
|
3600
|
+
}>;
|
|
3324
3601
|
validateAuthorizationCode: ({
|
|
3325
3602
|
code,
|
|
3326
3603
|
codeVerifier,
|
|
@@ -3356,6 +3633,7 @@ declare const socialProviders: {
|
|
|
3356
3633
|
vk: (options: VkOption) => {
|
|
3357
3634
|
id: "vk";
|
|
3358
3635
|
name: string;
|
|
3636
|
+
callbackPath: string;
|
|
3359
3637
|
createAuthorizationURL({
|
|
3360
3638
|
state,
|
|
3361
3639
|
scopes,
|
|
@@ -3370,7 +3648,10 @@ declare const socialProviders: {
|
|
|
3370
3648
|
display?: string | undefined;
|
|
3371
3649
|
loginHint?: string | undefined;
|
|
3372
3650
|
additionalParams?: Record<string, string> | undefined;
|
|
3373
|
-
}): Promise<
|
|
3651
|
+
}): Promise<{
|
|
3652
|
+
url: URL;
|
|
3653
|
+
requestedScopes: string[];
|
|
3654
|
+
}>;
|
|
3374
3655
|
validateAuthorizationCode: ({
|
|
3375
3656
|
code,
|
|
3376
3657
|
codeVerifier,
|
|
@@ -3407,8 +3688,10 @@ declare const socialProviders: {
|
|
|
3407
3688
|
zoom: (userOptions: ZoomOptions) => {
|
|
3408
3689
|
id: "zoom";
|
|
3409
3690
|
name: string;
|
|
3691
|
+
callbackPath: string;
|
|
3410
3692
|
createAuthorizationURL: ({
|
|
3411
3693
|
state,
|
|
3694
|
+
scopes,
|
|
3412
3695
|
redirectURI,
|
|
3413
3696
|
codeVerifier,
|
|
3414
3697
|
additionalParams
|
|
@@ -3420,7 +3703,10 @@ declare const socialProviders: {
|
|
|
3420
3703
|
display?: string | undefined;
|
|
3421
3704
|
loginHint?: string | undefined;
|
|
3422
3705
|
additionalParams?: Record<string, string> | undefined;
|
|
3423
|
-
}) => Promise<
|
|
3706
|
+
}) => Promise<{
|
|
3707
|
+
url: URL;
|
|
3708
|
+
requestedScopes: string[];
|
|
3709
|
+
}>;
|
|
3424
3710
|
validateAuthorizationCode: ({
|
|
3425
3711
|
code,
|
|
3426
3712
|
redirectURI,
|
|
@@ -3455,6 +3741,7 @@ declare const socialProviders: {
|
|
|
3455
3741
|
notion: (options: NotionOptions) => {
|
|
3456
3742
|
id: "notion";
|
|
3457
3743
|
name: string;
|
|
3744
|
+
callbackPath: string;
|
|
3458
3745
|
createAuthorizationURL({
|
|
3459
3746
|
state,
|
|
3460
3747
|
scopes,
|
|
@@ -3469,7 +3756,10 @@ declare const socialProviders: {
|
|
|
3469
3756
|
display?: string | undefined;
|
|
3470
3757
|
loginHint?: string | undefined;
|
|
3471
3758
|
additionalParams?: Record<string, string> | undefined;
|
|
3472
|
-
}): Promise<
|
|
3759
|
+
}): Promise<{
|
|
3760
|
+
url: URL;
|
|
3761
|
+
requestedScopes: string[];
|
|
3762
|
+
}>;
|
|
3473
3763
|
validateAuthorizationCode: ({
|
|
3474
3764
|
code,
|
|
3475
3765
|
redirectURI
|
|
@@ -3504,6 +3794,7 @@ declare const socialProviders: {
|
|
|
3504
3794
|
kakao: (options: KakaoOptions) => {
|
|
3505
3795
|
id: "kakao";
|
|
3506
3796
|
name: string;
|
|
3797
|
+
callbackPath: string;
|
|
3507
3798
|
createAuthorizationURL({
|
|
3508
3799
|
state,
|
|
3509
3800
|
scopes,
|
|
@@ -3517,7 +3808,10 @@ declare const socialProviders: {
|
|
|
3517
3808
|
display?: string | undefined;
|
|
3518
3809
|
loginHint?: string | undefined;
|
|
3519
3810
|
additionalParams?: Record<string, string> | undefined;
|
|
3520
|
-
}): Promise<
|
|
3811
|
+
}): Promise<{
|
|
3812
|
+
url: URL;
|
|
3813
|
+
requestedScopes: string[];
|
|
3814
|
+
}>;
|
|
3521
3815
|
validateAuthorizationCode: ({
|
|
3522
3816
|
code,
|
|
3523
3817
|
redirectURI
|
|
@@ -3573,6 +3867,7 @@ declare const socialProviders: {
|
|
|
3573
3867
|
naver: (options: NaverOptions) => {
|
|
3574
3868
|
id: "naver";
|
|
3575
3869
|
name: string;
|
|
3870
|
+
callbackPath: string;
|
|
3576
3871
|
createAuthorizationURL({
|
|
3577
3872
|
state,
|
|
3578
3873
|
scopes,
|
|
@@ -3586,7 +3881,10 @@ declare const socialProviders: {
|
|
|
3586
3881
|
display?: string | undefined;
|
|
3587
3882
|
loginHint?: string | undefined;
|
|
3588
3883
|
additionalParams?: Record<string, string> | undefined;
|
|
3589
|
-
}): Promise<
|
|
3884
|
+
}): Promise<{
|
|
3885
|
+
url: URL;
|
|
3886
|
+
requestedScopes: string[];
|
|
3887
|
+
}>;
|
|
3590
3888
|
validateAuthorizationCode: ({
|
|
3591
3889
|
code,
|
|
3592
3890
|
redirectURI
|
|
@@ -3642,6 +3940,7 @@ declare const socialProviders: {
|
|
|
3642
3940
|
line: (options: LineOptions) => {
|
|
3643
3941
|
id: "line";
|
|
3644
3942
|
name: string;
|
|
3943
|
+
callbackPath: string;
|
|
3645
3944
|
createAuthorizationURL({
|
|
3646
3945
|
state,
|
|
3647
3946
|
scopes,
|
|
@@ -3657,7 +3956,10 @@ declare const socialProviders: {
|
|
|
3657
3956
|
display?: string | undefined;
|
|
3658
3957
|
loginHint?: string | undefined;
|
|
3659
3958
|
additionalParams?: Record<string, string> | undefined;
|
|
3660
|
-
}): Promise<
|
|
3959
|
+
}): Promise<{
|
|
3960
|
+
url: URL;
|
|
3961
|
+
requestedScopes: string[];
|
|
3962
|
+
}>;
|
|
3661
3963
|
validateAuthorizationCode: ({
|
|
3662
3964
|
code,
|
|
3663
3965
|
codeVerifier,
|
|
@@ -3669,7 +3971,9 @@ declare const socialProviders: {
|
|
|
3669
3971
|
deviceId?: string | undefined;
|
|
3670
3972
|
}) => Promise<OAuth2Tokens>;
|
|
3671
3973
|
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
|
|
3672
|
-
|
|
3974
|
+
idToken: {
|
|
3975
|
+
verify: (token: string, nonce: string | undefined) => Promise<boolean>;
|
|
3976
|
+
};
|
|
3673
3977
|
getUserInfo(token: OAuth2Tokens & {
|
|
3674
3978
|
user?: {
|
|
3675
3979
|
name?: {
|
|
@@ -3715,6 +4019,7 @@ declare const socialProviders: {
|
|
|
3715
4019
|
paybin: (options: PaybinOptions) => {
|
|
3716
4020
|
id: "paybin";
|
|
3717
4021
|
name: string;
|
|
4022
|
+
callbackPath: string;
|
|
3718
4023
|
createAuthorizationURL({
|
|
3719
4024
|
state,
|
|
3720
4025
|
scopes,
|
|
@@ -3730,7 +4035,10 @@ declare const socialProviders: {
|
|
|
3730
4035
|
display?: string | undefined;
|
|
3731
4036
|
loginHint?: string | undefined;
|
|
3732
4037
|
additionalParams?: Record<string, string> | undefined;
|
|
3733
|
-
}): Promise<
|
|
4038
|
+
}): Promise<{
|
|
4039
|
+
url: URL;
|
|
4040
|
+
requestedScopes: string[];
|
|
4041
|
+
}>;
|
|
3734
4042
|
validateAuthorizationCode: ({
|
|
3735
4043
|
code,
|
|
3736
4044
|
codeVerifier,
|
|
@@ -3766,6 +4074,7 @@ declare const socialProviders: {
|
|
|
3766
4074
|
paypal: (options: PayPalOptions) => {
|
|
3767
4075
|
id: "paypal";
|
|
3768
4076
|
name: string;
|
|
4077
|
+
callbackPath: string;
|
|
3769
4078
|
createAuthorizationURL({
|
|
3770
4079
|
state,
|
|
3771
4080
|
codeVerifier,
|
|
@@ -3779,7 +4088,10 @@ declare const socialProviders: {
|
|
|
3779
4088
|
display?: string | undefined;
|
|
3780
4089
|
loginHint?: string | undefined;
|
|
3781
4090
|
additionalParams?: Record<string, string> | undefined;
|
|
3782
|
-
}): Promise<
|
|
4091
|
+
}): Promise<{
|
|
4092
|
+
url: URL;
|
|
4093
|
+
requestedScopes: string[];
|
|
4094
|
+
}>;
|
|
3783
4095
|
validateAuthorizationCode: ({
|
|
3784
4096
|
code,
|
|
3785
4097
|
redirectURI
|
|
@@ -3799,7 +4111,6 @@ declare const socialProviders: {
|
|
|
3799
4111
|
refreshToken: any;
|
|
3800
4112
|
accessTokenExpiresAt: Date | undefined;
|
|
3801
4113
|
}>);
|
|
3802
|
-
verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
|
|
3803
4114
|
getUserInfo(token: OAuth2Tokens & {
|
|
3804
4115
|
user?: {
|
|
3805
4116
|
name?: {
|
|
@@ -3845,6 +4156,7 @@ declare const socialProviders: {
|
|
|
3845
4156
|
polar: (options: PolarOptions) => {
|
|
3846
4157
|
id: "polar";
|
|
3847
4158
|
name: string;
|
|
4159
|
+
callbackPath: string;
|
|
3848
4160
|
createAuthorizationURL({
|
|
3849
4161
|
state,
|
|
3850
4162
|
scopes,
|
|
@@ -3859,7 +4171,10 @@ declare const socialProviders: {
|
|
|
3859
4171
|
display?: string | undefined;
|
|
3860
4172
|
loginHint?: string | undefined;
|
|
3861
4173
|
additionalParams?: Record<string, string> | undefined;
|
|
3862
|
-
}): Promise<
|
|
4174
|
+
}): Promise<{
|
|
4175
|
+
url: URL;
|
|
4176
|
+
requestedScopes: string[];
|
|
4177
|
+
}>;
|
|
3863
4178
|
validateAuthorizationCode: ({
|
|
3864
4179
|
code,
|
|
3865
4180
|
codeVerifier,
|
|
@@ -3895,6 +4210,7 @@ declare const socialProviders: {
|
|
|
3895
4210
|
railway: (options: RailwayOptions) => {
|
|
3896
4211
|
id: "railway";
|
|
3897
4212
|
name: string;
|
|
4213
|
+
callbackPath: string;
|
|
3898
4214
|
createAuthorizationURL({
|
|
3899
4215
|
state,
|
|
3900
4216
|
scopes,
|
|
@@ -3909,7 +4225,10 @@ declare const socialProviders: {
|
|
|
3909
4225
|
display?: string | undefined;
|
|
3910
4226
|
loginHint?: string | undefined;
|
|
3911
4227
|
additionalParams?: Record<string, string> | undefined;
|
|
3912
|
-
}): Promise<
|
|
4228
|
+
}): Promise<{
|
|
4229
|
+
url: URL;
|
|
4230
|
+
requestedScopes: string[];
|
|
4231
|
+
}>;
|
|
3913
4232
|
validateAuthorizationCode: ({
|
|
3914
4233
|
code,
|
|
3915
4234
|
codeVerifier,
|
|
@@ -3945,6 +4264,7 @@ declare const socialProviders: {
|
|
|
3945
4264
|
vercel: (options: VercelOptions) => {
|
|
3946
4265
|
id: "vercel";
|
|
3947
4266
|
name: string;
|
|
4267
|
+
callbackPath: string;
|
|
3948
4268
|
createAuthorizationURL({
|
|
3949
4269
|
state,
|
|
3950
4270
|
scopes,
|
|
@@ -3959,7 +4279,10 @@ declare const socialProviders: {
|
|
|
3959
4279
|
display?: string | undefined;
|
|
3960
4280
|
loginHint?: string | undefined;
|
|
3961
4281
|
additionalParams?: Record<string, string> | undefined;
|
|
3962
|
-
}): Promise<
|
|
4282
|
+
}): Promise<{
|
|
4283
|
+
url: URL;
|
|
4284
|
+
requestedScopes: string[];
|
|
4285
|
+
}>;
|
|
3963
4286
|
validateAuthorizationCode: ({
|
|
3964
4287
|
code,
|
|
3965
4288
|
codeVerifier,
|
|
@@ -3994,6 +4317,7 @@ declare const socialProviders: {
|
|
|
3994
4317
|
wechat: (options: WeChatOptions) => {
|
|
3995
4318
|
id: "wechat";
|
|
3996
4319
|
name: string;
|
|
4320
|
+
callbackPath: string;
|
|
3997
4321
|
createAuthorizationURL({
|
|
3998
4322
|
state,
|
|
3999
4323
|
scopes,
|
|
@@ -4007,7 +4331,10 @@ declare const socialProviders: {
|
|
|
4007
4331
|
display?: string | undefined;
|
|
4008
4332
|
loginHint?: string | undefined;
|
|
4009
4333
|
additionalParams?: Record<string, string> | undefined;
|
|
4010
|
-
}):
|
|
4334
|
+
}): {
|
|
4335
|
+
url: URL;
|
|
4336
|
+
requestedScopes: string[];
|
|
4337
|
+
};
|
|
4011
4338
|
validateAuthorizationCode: ({
|
|
4012
4339
|
code
|
|
4013
4340
|
}: {
|
|
@@ -4073,7 +4400,7 @@ declare const accountSchema: z.ZodObject<{
|
|
|
4073
4400
|
idToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
4074
4401
|
accessTokenExpiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
4075
4402
|
refreshTokenExpiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
4076
|
-
|
|
4403
|
+
grantedScopes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
4077
4404
|
password: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
4078
4405
|
}, z.core.$strip>;
|
|
4079
4406
|
type BaseAccount = z.infer<typeof accountSchema>;
|
|
@@ -4082,14 +4409,14 @@ type BaseAccount = z.infer<typeof accountSchema>;
|
|
|
4082
4409
|
*/
|
|
4083
4410
|
type Account<DBOptions extends BetterAuthOptions["account"] = BetterAuthOptions["account"], Plugins extends BetterAuthOptions["plugins"] = BetterAuthOptions["plugins"]> = Prettify$1<BaseAccount & InferDBFieldsFromOptions<DBOptions> & InferDBFieldsFromPlugins<"account", Plugins>>; //#endregion
|
|
4084
4411
|
//#endregion
|
|
4085
|
-
//#region ../../node_modules/.pnpm/better-call@1.3.
|
|
4412
|
+
//#region ../../node_modules/.pnpm/better-call@1.3.6_zod@4.3.6/node_modules/better-call/dist/helper.d.mts
|
|
4086
4413
|
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
4087
4414
|
type IsEmptyObject<T> = keyof T extends never ? true : false;
|
|
4088
4415
|
type UnionToIntersection<Union> = (Union extends unknown ? (distributedUnion: Union) => void : never) extends ((mergedIntersection: infer Intersection) => void) ? Intersection & Union : never;
|
|
4089
4416
|
type InferParamPath<Path> = Path extends `${infer _Start}:${infer Param}/${infer Rest}` ? { [K in Param | keyof InferParamPath<Rest>]: string } : Path extends `${infer _Start}:${infer Param}` ? { [K in Param]: string } : Path extends `${infer _Start}/${infer Rest}` ? InferParamPath<Rest> : {};
|
|
4090
4417
|
type InferParamWildCard<Path> = Path extends `${infer _Start}/*:${infer Param}/${infer Rest}` | `${infer _Start}/**:${infer Param}/${infer Rest}` ? { [K in Param | keyof InferParamPath<Rest>]: string } : Path extends `${infer _Start}/*` ? { [K in "_"]: string } : Path extends `${infer _Start}/${infer Rest}` ? InferParamWildCard<Rest> : {}; //#endregion
|
|
4091
4418
|
//#endregion
|
|
4092
|
-
//#region ../../node_modules/.pnpm/better-call@1.3.
|
|
4419
|
+
//#region ../../node_modules/.pnpm/better-call@1.3.6_zod@4.3.6/node_modules/better-call/dist/standard-schema.d.mts
|
|
4093
4420
|
//#region src/standard-schema.d.ts
|
|
4094
4421
|
/** The Standard Schema interface. */
|
|
4095
4422
|
interface StandardSchemaV1$1<Input = unknown, Output = Input> {
|
|
@@ -4147,7 +4474,7 @@ declare namespace StandardSchemaV1$1 {
|
|
|
4147
4474
|
type InferOutput<Schema extends StandardSchemaV1$1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
4148
4475
|
} //#endregion
|
|
4149
4476
|
//#endregion
|
|
4150
|
-
//#region ../../node_modules/.pnpm/better-call@1.3.
|
|
4477
|
+
//#region ../../node_modules/.pnpm/better-call@1.3.6_zod@4.3.6/node_modules/better-call/dist/error.d.mts
|
|
4151
4478
|
declare const statusCodes: {
|
|
4152
4479
|
OK: number;
|
|
4153
4480
|
CREATED: number;
|
|
@@ -4225,7 +4552,7 @@ declare const APIError: new (status?: Status | "OK" | "CREATED" | "ACCEPTED" | "
|
|
|
4225
4552
|
errorStack: string | undefined;
|
|
4226
4553
|
}; //#endregion
|
|
4227
4554
|
//#endregion
|
|
4228
|
-
//#region ../../node_modules/.pnpm/better-call@1.3.
|
|
4555
|
+
//#region ../../node_modules/.pnpm/better-call@1.3.6_zod@4.3.6/node_modules/better-call/dist/cookies.d.mts
|
|
4229
4556
|
//#region src/cookies.d.ts
|
|
4230
4557
|
type CookiePrefixOptions = "host" | "secure";
|
|
4231
4558
|
type CookieOptions = {
|
|
@@ -4315,7 +4642,7 @@ type CookieOptions = {
|
|
|
4315
4642
|
prefix?: CookiePrefixOptions;
|
|
4316
4643
|
};
|
|
4317
4644
|
//#endregion
|
|
4318
|
-
//#region ../../node_modules/.pnpm/better-call@1.3.
|
|
4645
|
+
//#region ../../node_modules/.pnpm/better-call@1.3.6_zod@4.3.6/node_modules/better-call/dist/openapi.d.mts
|
|
4319
4646
|
//#region src/openapi.d.ts
|
|
4320
4647
|
type OpenAPISchemaType = "string" | "number" | "integer" | "boolean" | "array" | "object";
|
|
4321
4648
|
interface OpenAPIParameter {
|
|
@@ -4337,7 +4664,7 @@ interface OpenAPIParameter {
|
|
|
4337
4664
|
};
|
|
4338
4665
|
}
|
|
4339
4666
|
//#endregion
|
|
4340
|
-
//#region ../../node_modules/.pnpm/better-call@1.3.
|
|
4667
|
+
//#region ../../node_modules/.pnpm/better-call@1.3.6_zod@4.3.6/node_modules/better-call/dist/endpoint.d.mts
|
|
4341
4668
|
//#region src/endpoint.d.ts
|
|
4342
4669
|
interface EndpointBaseOptions {
|
|
4343
4670
|
/**
|
|
@@ -4658,6 +4985,22 @@ type EndpointContext<Path extends string, Options extends EndpointOptions, Conte
|
|
|
4658
4985
|
* @returns - The cookie string
|
|
4659
4986
|
*/
|
|
4660
4987
|
setSignedCookie: (key: string, value: string, secret: string, options?: CookieOptions) => Promise<string>;
|
|
4988
|
+
/**
|
|
4989
|
+
* Response headers
|
|
4990
|
+
*
|
|
4991
|
+
* The live `Headers` for the response being built in the current
|
|
4992
|
+
* request. Read it to inspect what has already been queued, e.g. to
|
|
4993
|
+
* avoid emitting a `Set-Cookie` twice or to check headers set by an
|
|
4994
|
+
* earlier handler in the chain.
|
|
4995
|
+
*
|
|
4996
|
+
* @example
|
|
4997
|
+
* ```ts
|
|
4998
|
+
* const alreadySet = ctx.responseHeaders
|
|
4999
|
+
* .getSetCookie()
|
|
5000
|
+
* .some((c) => c.startsWith("session="));
|
|
5001
|
+
* ```
|
|
5002
|
+
*/
|
|
5003
|
+
responseHeaders: Headers;
|
|
4661
5004
|
/**
|
|
4662
5005
|
* JSON
|
|
4663
5006
|
*
|
|
@@ -4700,7 +5043,7 @@ type Endpoint<Path extends string = string, Options extends EndpointOptions = En
|
|
|
4700
5043
|
path: Path;
|
|
4701
5044
|
}; //#endregion
|
|
4702
5045
|
//#endregion
|
|
4703
|
-
//#region ../../node_modules/.pnpm/better-call@1.3.
|
|
5046
|
+
//#region ../../node_modules/.pnpm/better-call@1.3.6_zod@4.3.6/node_modules/better-call/dist/middleware.d.mts
|
|
4704
5047
|
//#region src/middleware.d.ts
|
|
4705
5048
|
interface MiddlewareOptions extends Omit<EndpointOptions, "method"> {}
|
|
4706
5049
|
type MiddlewareContext<Options extends MiddlewareOptions, Context = {}> = EndpointContext<string, Options & {
|
|
@@ -4807,7 +5150,7 @@ type Middleware<Options extends MiddlewareOptions = MiddlewareOptions, Handler e
|
|
|
4807
5150
|
options: Options;
|
|
4808
5151
|
}; //#endregion
|
|
4809
5152
|
//#endregion
|
|
4810
|
-
//#region ../../node_modules/.pnpm/better-call@1.3.
|
|
5153
|
+
//#region ../../node_modules/.pnpm/better-call@1.3.6_zod@4.3.6/node_modules/better-call/dist/context.d.mts
|
|
4811
5154
|
//#region src/context.d.ts
|
|
4812
5155
|
type HTTPMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
4813
5156
|
type Method = HTTPMethod | "*";
|
|
@@ -4943,11 +5286,13 @@ type GenericEndpointContext<Options extends BetterAuthOptions = BetterAuthOption
|
|
|
4943
5286
|
context: AuthContext<Options>;
|
|
4944
5287
|
};
|
|
4945
5288
|
interface InternalAdapter<_Options extends BetterAuthOptions = BetterAuthOptions> {
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
5289
|
+
createUser<T extends Record<string, any>>(user: Omit<User, "id" | "createdAt" | "updatedAt" | "emailVerified"> & Partial<User> & Record<string, any>,
|
|
5290
|
+
/**
|
|
5291
|
+
* Provisioning source. The creation seam adds `action: "create-user"` and
|
|
5292
|
+
* runs the `user.validateUserInfo` gate.
|
|
5293
|
+
*/
|
|
5294
|
+
|
|
5295
|
+
source: UserProvisioningSource): Promise<T & User>;
|
|
4951
5296
|
createAccount<T extends Record<string, any>>(account: Omit<Account, "id" | "createdAt" | "updatedAt"> & Partial<Account> & T): Promise<T & Account>;
|
|
4952
5297
|
listSessions(userId: string, options?: {
|
|
4953
5298
|
onlyActiveSessions?: boolean | undefined;
|
|
@@ -5102,7 +5447,7 @@ type AuthContext<Options extends BetterAuthOptions = BetterAuthOptions> = Plugin
|
|
|
5102
5447
|
session: Session & Record<string, any>;
|
|
5103
5448
|
user: User & Record<string, any>;
|
|
5104
5449
|
} | null) => void;
|
|
5105
|
-
socialProviders:
|
|
5450
|
+
socialProviders: UpstreamProvider[];
|
|
5106
5451
|
authCookies: BetterAuthCookies;
|
|
5107
5452
|
logger: ReturnType<typeof createLogger>;
|
|
5108
5453
|
rateLimit: {
|
|
@@ -5268,7 +5613,7 @@ declare const createAuthMiddleware: {
|
|
|
5268
5613
|
image?: string | null | undefined;
|
|
5269
5614
|
} & Record<string, any>;
|
|
5270
5615
|
} | null) => void;
|
|
5271
|
-
socialProviders:
|
|
5616
|
+
socialProviders: UpstreamProvider[];
|
|
5272
5617
|
authCookies: BetterAuthCookies;
|
|
5273
5618
|
logger: ReturnType<typeof createLogger>;
|
|
5274
5619
|
rateLimit: {
|
|
@@ -5397,7 +5742,7 @@ declare const createAuthMiddleware: {
|
|
|
5397
5742
|
image?: string | null | undefined;
|
|
5398
5743
|
} & Record<string, any>;
|
|
5399
5744
|
} | null) => void;
|
|
5400
|
-
socialProviders:
|
|
5745
|
+
socialProviders: UpstreamProvider[];
|
|
5401
5746
|
authCookies: BetterAuthCookies;
|
|
5402
5747
|
logger: ReturnType<typeof createLogger>;
|
|
5403
5748
|
rateLimit: {
|
|
@@ -5463,6 +5808,73 @@ type GenerateIdFn = (options: {
|
|
|
5463
5808
|
model: ModelNames;
|
|
5464
5809
|
size?: number | undefined;
|
|
5465
5810
|
}) => string | false;
|
|
5811
|
+
/**
|
|
5812
|
+
* What Better Auth is about to do with an incoming identity when
|
|
5813
|
+
* {@link BetterAuthOptions.user}'s `validateUserInfo` runs.
|
|
5814
|
+
*
|
|
5815
|
+
* - `create-user`: a brand-new user record is about to be created.
|
|
5816
|
+
* - `link-account`: a new provider account is about to be linked to an
|
|
5817
|
+
* already-existing user.
|
|
5818
|
+
* - `sign-in`: an existing OAuth or SSO user is signing in again. This is the
|
|
5819
|
+
* one case where the provider can assert *changed* data, so the hook receives
|
|
5820
|
+
* the fresh provider email and profile (not the stored row), letting a domain
|
|
5821
|
+
* or org policy reject a user whose provider identity moved out of bounds.
|
|
5822
|
+
*
|
|
5823
|
+
* Non-provider returning sign-ins are not re-validated: they carry only the
|
|
5824
|
+
* stored row, which has not changed since `create-user` gated it. Use the admin
|
|
5825
|
+
* plugin's ban controls or a `databaseHooks.session.create.before` hook to
|
|
5826
|
+
* block those.
|
|
5827
|
+
*/
|
|
5828
|
+
type ValidateUserInfoAction = "create-user" | "link-account" | "sign-in";
|
|
5829
|
+
/**
|
|
5830
|
+
* The authentication method that produced the incoming user info. The named
|
|
5831
|
+
* methods cover Better Auth's built-ins; the open `string` keeps it extensible
|
|
5832
|
+
* for plugins (for example `"scim"`).
|
|
5833
|
+
*/
|
|
5834
|
+
type ValidateUserInfoMethod = "oauth" | "sso-oidc" | "sso-saml" | "email-password" | "magic-link" | "email-otp" | "anonymous" | "siwe" | "phone-number" | "admin" | (string & {});
|
|
5835
|
+
/** OAuth-specific provisioning context; present only when `method` is `"oauth"`. */
|
|
5836
|
+
type ValidateUserInfoOAuthInfo = {
|
|
5837
|
+
/** The social or generic OAuth provider id (e.g. `"google"`). */providerId: string; /** The raw provider profile (userinfo or id-token claims), unmapped. */
|
|
5838
|
+
profile?: Record<string, unknown> | undefined;
|
|
5839
|
+
};
|
|
5840
|
+
/** SSO-specific provisioning context; present for OIDC and SAML SSO methods. */
|
|
5841
|
+
type ValidateUserInfoSSOInfo = {
|
|
5842
|
+
/** The configured SSO provider id. */providerId: string; /** The raw OIDC claims or SAML assertion attributes, unmapped. */
|
|
5843
|
+
profile?: Record<string, unknown> | undefined;
|
|
5844
|
+
};
|
|
5845
|
+
/** Provisioning origin passed to `createUser`; the creation seam adds `action: "create-user"` to build {@link ValidateUserInfoSource}. */
|
|
5846
|
+
type UserProvisioningSource = {
|
|
5847
|
+
method: ValidateUserInfoMethod; /** Provider id and raw profile; present iff `method` is `"oauth"`. */
|
|
5848
|
+
oauth?: ValidateUserInfoOAuthInfo | undefined; /** Provider id and raw profile; present iff `method` is `"sso-oidc"` or `"sso-saml"`. */
|
|
5849
|
+
sso?: ValidateUserInfoSSOInfo | undefined;
|
|
5850
|
+
};
|
|
5851
|
+
/**
|
|
5852
|
+
* The context passed to `validateUserInfo`: the lifecycle
|
|
5853
|
+
* {@link ValidateUserInfoAction}, the {@link ValidateUserInfoMethod}, and (for
|
|
5854
|
+
* OAuth/SSO provider methods) protocol-specific provider metadata.
|
|
5855
|
+
*
|
|
5856
|
+
* ```ts
|
|
5857
|
+
* // Scope to one OAuth provider:
|
|
5858
|
+
* if (source.oauth?.providerId !== "google") return;
|
|
5859
|
+
* // Branch on the method:
|
|
5860
|
+
* if (source.method === "anonymous") return { error: "no_anonymous" };
|
|
5861
|
+
* // Inspect SSO claims:
|
|
5862
|
+
* if (source.method === "sso-saml" && source.sso?.profile?.department !== "eng") {
|
|
5863
|
+
* return { error: "invalid_department" };
|
|
5864
|
+
* }
|
|
5865
|
+
* ```
|
|
5866
|
+
*/
|
|
5867
|
+
type ValidateUserInfoSource = UserProvisioningSource & {
|
|
5868
|
+
action: ValidateUserInfoAction;
|
|
5869
|
+
};
|
|
5870
|
+
type ValidateUserInfoResult = {
|
|
5871
|
+
/** A short, machine-readable rejection code, surfaced to the client. */error: string;
|
|
5872
|
+
/**
|
|
5873
|
+
* A human-readable reason, surfaced to the client. Do not put sensitive
|
|
5874
|
+
* details here.
|
|
5875
|
+
*/
|
|
5876
|
+
errorDescription?: string | undefined;
|
|
5877
|
+
};
|
|
5466
5878
|
/**
|
|
5467
5879
|
* Configuration for dynamic base URL resolution.
|
|
5468
5880
|
* Allows Better Auth to work with multiple domains (e.g., Vercel preview deployments).
|
|
@@ -6125,6 +6537,30 @@ type BetterAuthOptions = {
|
|
|
6125
6537
|
* User configuration
|
|
6126
6538
|
*/
|
|
6127
6539
|
user?: (BetterAuthDBOptions<"user", keyof BaseUser> & {
|
|
6540
|
+
/**
|
|
6541
|
+
* Gate which identities Better Auth admits. Called just before
|
|
6542
|
+
* `create-user`, `link-account`, and (for OAuth) `sign-in`, across
|
|
6543
|
+
* every authentication method, including stateless setups with no
|
|
6544
|
+
* persistent database. On `sign-in` the hook receives the *fresh*
|
|
6545
|
+
* provider email and profile, so a domain policy can reject a user
|
|
6546
|
+
* whose provider identity moved out of bounds.
|
|
6547
|
+
*
|
|
6548
|
+
* Non-provider returning sign-ins are not re-validated; use the admin
|
|
6549
|
+
* plugin's ban controls or a `databaseHooks.session.create.before`
|
|
6550
|
+
* hook for those.
|
|
6551
|
+
*
|
|
6552
|
+
* Return nothing to allow; return `{ error }` to reject. Browser flows
|
|
6553
|
+
* redirect to the configured error URL; programmatic flows surface a
|
|
6554
|
+
* `403`.
|
|
6555
|
+
*
|
|
6556
|
+
* TODO: rename to `validateUser` (and the `ValidateUserInfo*` types).
|
|
6557
|
+
* "UserInfo" is the OIDC term and misleads for the email/password,
|
|
6558
|
+
* SIWE, phone, and admin methods.
|
|
6559
|
+
*/
|
|
6560
|
+
validateUserInfo?: (data: {
|
|
6561
|
+
user: Partial<User> & Record<string, unknown>;
|
|
6562
|
+
source: ValidateUserInfoSource;
|
|
6563
|
+
}, context: GenericEndpointContext) => Awaitable<void | ValidateUserInfoResult>;
|
|
6128
6564
|
/**
|
|
6129
6565
|
* Changing email configuration
|
|
6130
6566
|
*/
|