@better-auth-ui/core 1.6.30 → 1.6.32
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/{create-auth-plugin-DcxR23rZ.js → create-auth-plugin-D4wsYnHD.js} +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +46 -15
- package/dist/lib/auth-mutation-keys.d.ts +5 -4
- package/dist/lib/auth-redirect.d.ts +31 -0
- package/dist/lib/view-paths.d.ts +5 -0
- package/dist/plugins/admin/admin-localization.d.ts +5 -0
- package/dist/plugins/admin/admin-mutation-keys.d.ts +9 -0
- package/dist/plugins/admin/admin-plugin.d.ts +32 -0
- package/dist/plugins/device-authorization/device-authorization-localization.d.ts +33 -0
- package/dist/plugins/device-authorization/device-authorization-mutation-keys.d.ts +16 -0
- package/dist/plugins/device-authorization/device-authorization-plugin.d.ts +59 -0
- package/dist/plugins/oauth-provider/oauth-provider-localization.d.ts +25 -0
- package/dist/plugins/oauth-provider/oauth-provider-mutation-keys.d.ts +12 -0
- package/dist/plugins/oauth-provider/oauth-provider-plugin.d.ts +78 -0
- package/dist/plugins/oauth-provider/oauth-provider-query-keys.d.ts +9 -0
- package/dist/plugins.d.ts +10 -0
- package/dist/plugins.js +193 -63
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/lib/auth-mutation-keys.ts +5 -4
- package/src/lib/auth-redirect.ts +105 -0
- package/src/lib/view-paths.ts +6 -0
- package/src/plugins/admin/admin-localization.ts +6 -0
- package/src/plugins/admin/admin-mutation-keys.ts +9 -0
- package/src/plugins/admin/admin-plugin.ts +52 -0
- package/src/plugins/device-authorization/device-authorization-localization.ts +36 -0
- package/src/plugins/device-authorization/device-authorization-mutation-keys.ts +16 -0
- package/src/plugins/device-authorization/device-authorization-plugin.ts +65 -0
- package/src/plugins/oauth-provider/oauth-provider-localization.ts +27 -0
- package/src/plugins/oauth-provider/oauth-provider-mutation-keys.ts +12 -0
- package/src/plugins/oauth-provider/oauth-provider-plugin.ts +132 -0
- package/src/plugins/oauth-provider/oauth-provider-query-keys.ts +10 -0
- package/src/plugins.ts +10 -0
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './config';
|
|
|
2
2
|
export * from './lib/auth-mutation-keys';
|
|
3
3
|
export * from './lib/auth-plugin';
|
|
4
4
|
export * from './lib/auth-query-keys';
|
|
5
|
+
export * from './lib/auth-redirect';
|
|
5
6
|
export * from './lib/base-paths';
|
|
6
7
|
export * from './lib/create-auth-plugin';
|
|
7
8
|
export * from './lib/deep-partial';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "./create-auth-plugin-
|
|
1
|
+
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "./create-auth-plugin-D4wsYnHD.js";
|
|
2
2
|
//#region src/config/additional-fields-config.ts
|
|
3
3
|
function l(e, t) {
|
|
4
4
|
if (e.type === "boolean") return t === "on" || t === "true";
|
|
@@ -59,7 +59,38 @@ var d = {
|
|
|
59
59
|
revokeSession: ["auth", "revokeSession"],
|
|
60
60
|
unlinkAccount: ["auth", "unlinkAccount"],
|
|
61
61
|
updateUser: ["auth", "updateUser"]
|
|
62
|
-
}, f =
|
|
62
|
+
}, f = /^https?:\/\//i;
|
|
63
|
+
function p(e) {
|
|
64
|
+
for (let t of e) {
|
|
65
|
+
let e = t.codePointAt(0);
|
|
66
|
+
if (t === "\\" || e === void 0 || e <= 31 || e === 127) return !0;
|
|
67
|
+
}
|
|
68
|
+
return !1;
|
|
69
|
+
}
|
|
70
|
+
function m(e, t) {
|
|
71
|
+
if (!e || p(e)) return "/";
|
|
72
|
+
let n = e.trim();
|
|
73
|
+
if (!n || n.startsWith("//") || !n.startsWith("/") && !f.test(n)) return "/";
|
|
74
|
+
try {
|
|
75
|
+
let e = new URL(t), r = new URL(n, e);
|
|
76
|
+
return r.origin !== e.origin || r.username || r.password ? "/" : `${r.pathname}${r.search}${r.hash}`;
|
|
77
|
+
} catch {
|
|
78
|
+
return "/";
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function h(e, t, n) {
|
|
82
|
+
let r = m(e.searchParams.get("redirectTo"), e.origin), i = new URL(r, e.origin).pathname === e.pathname ? "/" : r;
|
|
83
|
+
if (t) return {
|
|
84
|
+
type: "redirect",
|
|
85
|
+
to: i
|
|
86
|
+
};
|
|
87
|
+
let a = new URL(n, e.origin);
|
|
88
|
+
return a.searchParams.set("redirectTo", `${e.pathname}${e.search}${e.hash}`), {
|
|
89
|
+
type: "signIn",
|
|
90
|
+
to: `${a.pathname}${a.search}${a.hash}`
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
var g = {
|
|
63
94
|
version: "2.0",
|
|
64
95
|
providers: [
|
|
65
96
|
{
|
|
@@ -1476,26 +1507,26 @@ var d = {
|
|
|
1476
1507
|
domains: 223,
|
|
1477
1508
|
generated: "2025-12-09T10:38:50.000Z"
|
|
1478
1509
|
}
|
|
1479
|
-
},
|
|
1480
|
-
function
|
|
1481
|
-
if (
|
|
1482
|
-
|
|
1483
|
-
let { providers: e } =
|
|
1484
|
-
for (let t of e) if (t.loginUrl) for (let e of t.domains ?? [])
|
|
1510
|
+
}, _;
|
|
1511
|
+
function v() {
|
|
1512
|
+
if (_) return _;
|
|
1513
|
+
_ = /* @__PURE__ */ new Map();
|
|
1514
|
+
let { providers: e } = g;
|
|
1515
|
+
for (let t of e) if (t.loginUrl) for (let e of t.domains ?? []) _.set(e.toLowerCase(), {
|
|
1485
1516
|
companyProvider: t.companyProvider,
|
|
1486
1517
|
loginUrl: t.loginUrl
|
|
1487
1518
|
});
|
|
1488
|
-
return
|
|
1519
|
+
return _;
|
|
1489
1520
|
}
|
|
1490
|
-
function
|
|
1521
|
+
function y(e) {
|
|
1491
1522
|
let t = e.lastIndexOf("@");
|
|
1492
1523
|
if (t === -1) return null;
|
|
1493
1524
|
let n = e.slice(t + 1).trim().toLowerCase();
|
|
1494
|
-
return n ?
|
|
1525
|
+
return n ? v().get(n) ?? null : null;
|
|
1495
1526
|
}
|
|
1496
1527
|
//#endregion
|
|
1497
1528
|
//#region src/lib/provider-names.ts
|
|
1498
|
-
var
|
|
1529
|
+
var b = {
|
|
1499
1530
|
apple: "Apple",
|
|
1500
1531
|
atlassian: "Atlassian",
|
|
1501
1532
|
cognito: "Cognito",
|
|
@@ -1532,8 +1563,8 @@ var g = {
|
|
|
1532
1563
|
wechat: "WeChat",
|
|
1533
1564
|
zoom: "Zoom"
|
|
1534
1565
|
};
|
|
1535
|
-
function
|
|
1536
|
-
return
|
|
1566
|
+
function x(e) {
|
|
1567
|
+
return b[e] || e.charAt(0).toUpperCase() + e.slice(1);
|
|
1537
1568
|
}
|
|
1538
1569
|
//#endregion
|
|
1539
|
-
export { d as authMutationKeys, i as authQueryKeys, r as basePaths, c as createAuthPlugin, e as deepmerge, o as defaultAuthConfig, a as fileToBase64, h as getEmailProviderLink,
|
|
1570
|
+
export { d as authMutationKeys, i as authQueryKeys, r as basePaths, c as createAuthPlugin, e as deepmerge, o as defaultAuthConfig, a as fileToBase64, h as getAuthRedirectAction, y as getEmailProviderLink, x as getProviderName, m as getSafeRedirectTo, t as localization, l as parseAdditionalFieldValue, b as providerNames, s as resizeAvatar, u as resolveInputType, n as viewPaths };
|
|
@@ -19,10 +19,11 @@
|
|
|
19
19
|
* package the mutation options factory came from.
|
|
20
20
|
*
|
|
21
21
|
* Plugin-specific mutation keys live alongside their plugin (e.g.
|
|
22
|
-
* `apiKeyMutationKeys`, `
|
|
23
|
-
* `
|
|
24
|
-
* `deleteUserMutationKeys`).
|
|
25
|
-
*
|
|
22
|
+
* `apiKeyMutationKeys`, `deviceAuthorizationMutationKeys`,
|
|
23
|
+
* `organizationMutationKeys`, `passkeyMutationKeys`, `magicLinkMutationKeys`,
|
|
24
|
+
* `multiSessionMutationKeys`, `usernameMutationKeys`, `deleteUserMutationKeys`).
|
|
25
|
+
* Plugin-contributed sign-in strategies stay under the shared
|
|
26
|
+
* `["auth", "signIn", ...]` namespace so
|
|
26
27
|
* `useIsMutating({ mutationKey: authMutationKeys.signIn.all })` still
|
|
27
28
|
* matches them.
|
|
28
29
|
*
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize a redirect target to a same-origin path.
|
|
3
|
+
*
|
|
4
|
+
* Root-relative paths and same-origin HTTP(S) URLs are accepted. Invalid,
|
|
5
|
+
* cross-origin, protocol-relative, and non-HTTP targets fall back to `/`.
|
|
6
|
+
*
|
|
7
|
+
* @param redirectTo - Requested redirect target
|
|
8
|
+
* @param origin - Origin used to validate and normalize the target
|
|
9
|
+
* @returns A same-origin path including its query string and hash
|
|
10
|
+
*/
|
|
11
|
+
export declare function getSafeRedirectTo(redirectTo: string | null | undefined, origin: string): string;
|
|
12
|
+
export type AuthRedirectAction = {
|
|
13
|
+
type: "redirect";
|
|
14
|
+
to: string;
|
|
15
|
+
} | {
|
|
16
|
+
type: "signIn";
|
|
17
|
+
to: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Resolve the next action for the authenticated redirect view.
|
|
21
|
+
*
|
|
22
|
+
* Signed-in users continue to the validated target. Signed-out users are sent
|
|
23
|
+
* to sign in with the current redirect-view URL preserved, allowing the view
|
|
24
|
+
* to perform a full-page redirect after authentication.
|
|
25
|
+
*
|
|
26
|
+
* @param currentURL - Current redirect-view URL
|
|
27
|
+
* @param authenticated - Whether the current user has a session
|
|
28
|
+
* @param signInPath - Same-origin path to the sign-in view
|
|
29
|
+
* @returns The redirect or sign-in action to perform
|
|
30
|
+
*/
|
|
31
|
+
export declare function getAuthRedirectAction(currentURL: URL, authenticated: boolean, signInPath: string): AuthRedirectAction;
|
package/dist/lib/view-paths.d.ts
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
* View path segments for authentication routes.
|
|
3
3
|
*/
|
|
4
4
|
export interface AuthViewPaths {
|
|
5
|
+
/**
|
|
6
|
+
* Path segment for the authenticated redirect view
|
|
7
|
+
* @default "redirect"
|
|
8
|
+
*/
|
|
9
|
+
redirect: string;
|
|
5
10
|
/**
|
|
6
11
|
* Path segment for the sign-in view
|
|
7
12
|
* @default "sign-in"
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mutation keys contributed by the admin plugin.
|
|
3
|
+
*/
|
|
4
|
+
export declare const adminMutationKeys: {
|
|
5
|
+
/** Root key for every admin mutation. */
|
|
6
|
+
readonly all: readonly ["auth", "admin"];
|
|
7
|
+
/** Key for `admin.stopImpersonating`. */
|
|
8
|
+
readonly stopImpersonating: readonly ["auth", "admin", "stopImpersonating"];
|
|
9
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AdminLocalization } from './admin-localization';
|
|
2
|
+
export type AdminPluginOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Override the plugin's default localization strings.
|
|
5
|
+
* @remarks `AdminLocalization`
|
|
6
|
+
*/
|
|
7
|
+
localization?: Partial<AdminLocalization>;
|
|
8
|
+
};
|
|
9
|
+
export type ImpersonatingSession = {
|
|
10
|
+
session: {
|
|
11
|
+
impersonatedBy: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Check whether a Better Auth session belongs to an impersonated user.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isImpersonatingSession(session: unknown): session is ImpersonatingSession;
|
|
18
|
+
/**
|
|
19
|
+
* Adds UI integrations for Better Auth's admin plugin.
|
|
20
|
+
*
|
|
21
|
+
* Pair this UI plugin with Better Auth's `admin()` server plugin and
|
|
22
|
+
* `adminClient()` client plugin.
|
|
23
|
+
*/
|
|
24
|
+
export declare const adminPlugin: ((options?: AdminPluginOptions | undefined) => {
|
|
25
|
+
localization: {
|
|
26
|
+
stopImpersonating: string;
|
|
27
|
+
};
|
|
28
|
+
} & {
|
|
29
|
+
id: "admin";
|
|
30
|
+
}) & {
|
|
31
|
+
id: "admin";
|
|
32
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const deviceAuthorizationLocalization: {
|
|
2
|
+
/** @remarks `"Device Authorization"` */
|
|
3
|
+
deviceAuthorization: string;
|
|
4
|
+
/** @remarks `"Enter the code displayed on your device."` */
|
|
5
|
+
deviceAuthorizationDescription: string;
|
|
6
|
+
/** @remarks `"Device code"` */
|
|
7
|
+
deviceCode: string;
|
|
8
|
+
/** @remarks `"The code is invalid or has expired."` */
|
|
9
|
+
invalidDeviceCode: string;
|
|
10
|
+
/** @remarks `"Continue"` */
|
|
11
|
+
continue: string;
|
|
12
|
+
/** @remarks `"Approve Device"` */
|
|
13
|
+
approveDevice: string;
|
|
14
|
+
/** @remarks `"A device is requesting access to your account."` */
|
|
15
|
+
approveDeviceDescription: string;
|
|
16
|
+
/** @remarks `"Signed in as"` */
|
|
17
|
+
signedInAs: string;
|
|
18
|
+
/** @remarks `"Approve"` */
|
|
19
|
+
approve: string;
|
|
20
|
+
/** @remarks `"Deny"` */
|
|
21
|
+
deny: string;
|
|
22
|
+
/** @remarks `"Device Approved"` */
|
|
23
|
+
deviceApproved: string;
|
|
24
|
+
/** @remarks `"The device can now access your account. You can return to it and continue."` */
|
|
25
|
+
deviceApprovedDescription: string;
|
|
26
|
+
/** @remarks `"Device Denied"` */
|
|
27
|
+
deviceDenied: string;
|
|
28
|
+
/** @remarks `"The device was not granted access to your account."` */
|
|
29
|
+
deviceDeniedDescription: string;
|
|
30
|
+
/** @remarks `"Return to application"` */
|
|
31
|
+
returnToApplication: string;
|
|
32
|
+
};
|
|
33
|
+
export type DeviceAuthorizationLocalization = typeof deviceAuthorizationLocalization;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mutation keys contributed by the device-authorization plugin.
|
|
3
|
+
*
|
|
4
|
+
* All keys live under the shared `["auth"]` namespace so global auth
|
|
5
|
+
* mutation observers handle errors consistently.
|
|
6
|
+
*/
|
|
7
|
+
export declare const deviceAuthorizationMutationKeys: {
|
|
8
|
+
/** Prefix matching every device-authorization mutation. */
|
|
9
|
+
readonly all: readonly ["auth", "deviceAuthorization"];
|
|
10
|
+
/** Key for verifying and claiming a user code. */
|
|
11
|
+
readonly verify: readonly ["auth", "deviceAuthorization", "verify"];
|
|
12
|
+
/** Key for approving a pending device request. */
|
|
13
|
+
readonly approve: readonly ["auth", "deviceAuthorization", "approve"];
|
|
14
|
+
/** Key for denying a pending device request. */
|
|
15
|
+
readonly deny: readonly ["auth", "deviceAuthorization", "deny"];
|
|
16
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { DeviceAuthorizationLocalization } from './device-authorization-localization';
|
|
2
|
+
declare module "../../lib/view-paths" {
|
|
3
|
+
/** Widens `AuthViewPaths` with the device-authorization path when this plugin is imported. */
|
|
4
|
+
interface AuthViewPaths {
|
|
5
|
+
/** @default "device" */
|
|
6
|
+
deviceAuthorization?: string;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export type DeviceAuthorizationPluginOptions = {
|
|
10
|
+
/**
|
|
11
|
+
* Override the plugin's default localization strings.
|
|
12
|
+
* @remarks `DeviceAuthorizationLocalization`
|
|
13
|
+
*/
|
|
14
|
+
localization?: Partial<DeviceAuthorizationLocalization>;
|
|
15
|
+
/**
|
|
16
|
+
* URL segment for the device-authorization view.
|
|
17
|
+
* @remarks `string`
|
|
18
|
+
* @default "device"
|
|
19
|
+
*/
|
|
20
|
+
path?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Number of characters rendered by the device-code input.
|
|
23
|
+
*
|
|
24
|
+
* Keep this in sync with Better Auth's `deviceAuthorization({ userCodeLength })`
|
|
25
|
+
* server option.
|
|
26
|
+
*
|
|
27
|
+
* @default 8
|
|
28
|
+
*/
|
|
29
|
+
userCodeLength?: number;
|
|
30
|
+
};
|
|
31
|
+
export declare const deviceAuthorizationPlugin: ((options?: DeviceAuthorizationPluginOptions | undefined) => {
|
|
32
|
+
localization: {
|
|
33
|
+
deviceAuthorization: string;
|
|
34
|
+
deviceAuthorizationDescription: string;
|
|
35
|
+
deviceCode: string;
|
|
36
|
+
invalidDeviceCode: string;
|
|
37
|
+
continue: string;
|
|
38
|
+
approveDevice: string;
|
|
39
|
+
approveDeviceDescription: string;
|
|
40
|
+
signedInAs: string;
|
|
41
|
+
approve: string;
|
|
42
|
+
deny: string;
|
|
43
|
+
deviceApproved: string;
|
|
44
|
+
deviceApprovedDescription: string;
|
|
45
|
+
deviceDenied: string;
|
|
46
|
+
deviceDeniedDescription: string;
|
|
47
|
+
returnToApplication: string;
|
|
48
|
+
};
|
|
49
|
+
userCodeLength: number;
|
|
50
|
+
viewPaths: {
|
|
51
|
+
auth: {
|
|
52
|
+
deviceAuthorization: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
} & {
|
|
56
|
+
id: "deviceAuthorization";
|
|
57
|
+
}) & {
|
|
58
|
+
id: "deviceAuthorization";
|
|
59
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const oauthProviderLocalization: {
|
|
2
|
+
/** @remarks `"Authorize {{client}}"` */
|
|
3
|
+
authorize: string;
|
|
4
|
+
/** @remarks `"{{client}} wants to access your account."` */
|
|
5
|
+
authorizationDescription: string;
|
|
6
|
+
/** @remarks `"This will allow {{client}} to:"` */
|
|
7
|
+
requestedPermissions: string;
|
|
8
|
+
/** @remarks `"Signed in as"` */
|
|
9
|
+
signedInAs: string;
|
|
10
|
+
/** @remarks `"Allow"` */
|
|
11
|
+
allow: string;
|
|
12
|
+
/** @remarks `"Cancel"` */
|
|
13
|
+
cancel: string;
|
|
14
|
+
/** @remarks `"Privacy policy"` */
|
|
15
|
+
privacyPolicy: string;
|
|
16
|
+
/** @remarks `"Terms of service"` */
|
|
17
|
+
termsOfService: string;
|
|
18
|
+
/** @remarks `"Invalid authorization request"` */
|
|
19
|
+
invalidRequest: string;
|
|
20
|
+
/** @remarks `"This authorization request is missing required information or is no longer valid."` */
|
|
21
|
+
invalidRequestDescription: string;
|
|
22
|
+
/** @remarks `"Application"` */
|
|
23
|
+
application: string;
|
|
24
|
+
};
|
|
25
|
+
export type OAuthProviderLocalization = typeof oauthProviderLocalization;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mutation keys contributed by the OAuth provider plugin.
|
|
3
|
+
*
|
|
4
|
+
* All keys live under the shared `["auth"]` namespace so global auth
|
|
5
|
+
* mutation observers handle errors consistently.
|
|
6
|
+
*/
|
|
7
|
+
export declare const oauthProviderMutationKeys: {
|
|
8
|
+
/** Prefix matching every OAuth provider mutation. */
|
|
9
|
+
readonly all: readonly ["auth", "oauthProvider"];
|
|
10
|
+
/** Key for accepting or denying an OAuth authorization request. */
|
|
11
|
+
readonly consent: readonly ["auth", "oauthProvider", "consent"];
|
|
12
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { OAuthProviderLocalization } from './oauth-provider-localization';
|
|
2
|
+
declare module "../../lib/view-paths" {
|
|
3
|
+
/** Widens `AuthViewPaths` with the OAuth consent path when this plugin is imported. */
|
|
4
|
+
interface AuthViewPaths {
|
|
5
|
+
/** @default "consent" */
|
|
6
|
+
oauthConsent?: string;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export type OAuthScopeMetadata = {
|
|
10
|
+
/** Short permission label displayed to the user. */
|
|
11
|
+
label: string;
|
|
12
|
+
/** Optional explanation of the data or access represented by the scope. */
|
|
13
|
+
description?: string;
|
|
14
|
+
};
|
|
15
|
+
export type OAuthScopeMetadataMap = Record<string, OAuthScopeMetadata>;
|
|
16
|
+
export declare const oauthProviderScopeMetadata: OAuthScopeMetadataMap;
|
|
17
|
+
export type OAuthAuthorizationRequest = {
|
|
18
|
+
clientId?: string;
|
|
19
|
+
scopes: string[];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Keep client-controlled links and images on browser-safe web protocols.
|
|
23
|
+
*/
|
|
24
|
+
export declare function sanitizeOAuthClientUrl(value: string | null | undefined): string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Read the display-safe parts of Better Auth's signed authorization query.
|
|
27
|
+
*
|
|
28
|
+
* The complete query string must remain in the browser URL so
|
|
29
|
+
* `oauthProviderClient()` can forward and verify it during consent.
|
|
30
|
+
*/
|
|
31
|
+
export declare function parseOAuthAuthorizationRequest(search: string): OAuthAuthorizationRequest;
|
|
32
|
+
export type OAuthProviderPluginOptions = {
|
|
33
|
+
/**
|
|
34
|
+
* Override the plugin's default localization strings.
|
|
35
|
+
* @remarks `OAuthProviderLocalization`
|
|
36
|
+
*/
|
|
37
|
+
localization?: Partial<OAuthProviderLocalization>;
|
|
38
|
+
/**
|
|
39
|
+
* URL segment for the OAuth consent view.
|
|
40
|
+
* @remarks `string`
|
|
41
|
+
* @default "consent"
|
|
42
|
+
*/
|
|
43
|
+
path?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Labels and descriptions for custom OAuth scopes.
|
|
46
|
+
*
|
|
47
|
+
* Entries override the built-in metadata for `openid`, `profile`, `email`,
|
|
48
|
+
* and `offline_access`. Unknown scopes remain visible using their raw value.
|
|
49
|
+
*/
|
|
50
|
+
scopeMetadata?: OAuthScopeMetadataMap;
|
|
51
|
+
};
|
|
52
|
+
export declare const oauthProviderPlugin: ((options?: OAuthProviderPluginOptions | undefined) => {
|
|
53
|
+
localization: {
|
|
54
|
+
authorize: string;
|
|
55
|
+
authorizationDescription: string;
|
|
56
|
+
requestedPermissions: string;
|
|
57
|
+
signedInAs: string;
|
|
58
|
+
allow: string;
|
|
59
|
+
cancel: string;
|
|
60
|
+
privacyPolicy: string;
|
|
61
|
+
termsOfService: string;
|
|
62
|
+
invalidRequest: string;
|
|
63
|
+
invalidRequestDescription: string;
|
|
64
|
+
application: string;
|
|
65
|
+
};
|
|
66
|
+
scopeMetadata: {
|
|
67
|
+
[x: string]: OAuthScopeMetadata;
|
|
68
|
+
};
|
|
69
|
+
viewPaths: {
|
|
70
|
+
auth: {
|
|
71
|
+
oauthConsent: string;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
} & {
|
|
75
|
+
id: "oauthProvider";
|
|
76
|
+
}) & {
|
|
77
|
+
id: "oauthProvider";
|
|
78
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Query keys contributed by the OAuth provider plugin. */
|
|
2
|
+
export declare const oauthProviderQueryKeys: {
|
|
3
|
+
/** Prefix matching every OAuth provider query. */
|
|
4
|
+
readonly all: readonly ["auth", "oauthProvider"];
|
|
5
|
+
/** Prefix for public OAuth client metadata queries. */
|
|
6
|
+
readonly publicClients: readonly ["auth", "oauthProvider", "publicClient"];
|
|
7
|
+
/** Key for the public metadata of a specific OAuth client. */
|
|
8
|
+
readonly publicClient: (clientId: string | undefined) => readonly ["auth", "oauthProvider", "publicClient", string | null];
|
|
9
|
+
};
|
package/dist/plugins.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export * from './plugins/admin/admin-localization';
|
|
2
|
+
export * from './plugins/admin/admin-mutation-keys';
|
|
3
|
+
export * from './plugins/admin/admin-plugin';
|
|
1
4
|
export * from './plugins/api-key/api-key-localization';
|
|
2
5
|
export * from './plugins/api-key/api-key-mutation-keys';
|
|
3
6
|
export * from './plugins/api-key/api-key-plugin';
|
|
@@ -5,6 +8,9 @@ export * from './plugins/api-key/api-key-query-keys';
|
|
|
5
8
|
export * from './plugins/delete-user/delete-user-localization';
|
|
6
9
|
export * from './plugins/delete-user/delete-user-mutation-keys';
|
|
7
10
|
export * from './plugins/delete-user/delete-user-plugin';
|
|
11
|
+
export * from './plugins/device-authorization/device-authorization-localization';
|
|
12
|
+
export * from './plugins/device-authorization/device-authorization-mutation-keys';
|
|
13
|
+
export * from './plugins/device-authorization/device-authorization-plugin';
|
|
8
14
|
export * from './plugins/last-login-method/last-login-method-localization';
|
|
9
15
|
export * from './plugins/last-login-method/last-login-method-plugin';
|
|
10
16
|
export * from './plugins/magic-link/magic-link-localization';
|
|
@@ -14,6 +20,10 @@ export * from './plugins/multi-session/multi-session-localization';
|
|
|
14
20
|
export * from './plugins/multi-session/multi-session-mutation-keys';
|
|
15
21
|
export * from './plugins/multi-session/multi-session-plugin';
|
|
16
22
|
export * from './plugins/multi-session/multi-session-query-keys';
|
|
23
|
+
export * from './plugins/oauth-provider/oauth-provider-localization';
|
|
24
|
+
export * from './plugins/oauth-provider/oauth-provider-mutation-keys';
|
|
25
|
+
export * from './plugins/oauth-provider/oauth-provider-plugin';
|
|
26
|
+
export * from './plugins/oauth-provider/oauth-provider-query-keys';
|
|
17
27
|
export * from './plugins/organization/organization-localization';
|
|
18
28
|
export * from './plugins/organization/organization-mutation-keys';
|
|
19
29
|
export * from './plugins/organization/organization-plugin';
|