@better-auth/oauth-provider 1.6.26 → 1.6.28
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-resource.d.mts +5 -7
- package/dist/client-resource.mjs +3 -3
- package/dist/client.d.mts +4 -2
- package/dist/client.mjs +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +7 -8
- package/dist/{oauth-dQVivAXR.d.mts → oauth-C5Ss3rSz.d.mts} +68 -64
- package/dist/{oauth-BFBataE_.d.mts → oauth-D74mBkw6.d.mts} +13 -25
- package/dist/{utils-DYn-npiB.mjs → utils-BX7pt3Pi.mjs} +1 -1
- package/dist/{version-BZrv-Tx8.mjs → version-D0csl_Bb.mjs} +2 -2
- package/package.json +7 -7
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { s as ResourceServerMetadata } from "./oauth-
|
|
1
|
+
import { s as ResourceServerMetadata } from "./oauth-D74mBkw6.mjs";
|
|
2
2
|
import { JWTPayload, JWTVerifyOptions } from "jose";
|
|
3
3
|
import { BetterAuthOptions } from "better-auth/types";
|
|
4
|
+
|
|
4
5
|
//#region src/client-resource.d.ts
|
|
5
6
|
type ResourceClientAuth = {
|
|
6
7
|
options: {
|
|
@@ -68,23 +69,20 @@ type VerifyAccessTokenAuthOpts = {
|
|
|
68
69
|
verifyOptions?: JWTVerifyOptions & Required<Pick<JWTVerifyOptions, "audience">>;
|
|
69
70
|
scopes?: string[];
|
|
70
71
|
jwksUrl?: string;
|
|
71
|
-
remoteVerify?: VerifyAccessTokenRemote;
|
|
72
|
-
/** Maps non-url (ie urn, client) resources to resource_metadata */
|
|
72
|
+
remoteVerify?: VerifyAccessTokenRemote; /** Maps non-url (ie urn, client) resources to resource_metadata */
|
|
73
73
|
resourceMetadataMappings?: Record<string, string>;
|
|
74
74
|
};
|
|
75
75
|
type VerifyAccessTokenNoAuthOpts = {
|
|
76
76
|
verifyOptions: JWTVerifyOptions & Required<Pick<JWTVerifyOptions, "audience" | "issuer">>;
|
|
77
77
|
scopes?: string[];
|
|
78
78
|
jwksUrl: string;
|
|
79
|
-
remoteVerify?: VerifyAccessTokenRemote;
|
|
80
|
-
/** Maps non-url (ie urn, client) resources to resource_metadata */
|
|
79
|
+
remoteVerify?: VerifyAccessTokenRemote; /** Maps non-url (ie urn, client) resources to resource_metadata */
|
|
81
80
|
resourceMetadataMappings?: Record<string, string>;
|
|
82
81
|
} | {
|
|
83
82
|
verifyOptions: JWTVerifyOptions & Required<Pick<JWTVerifyOptions, "audience" | "issuer">>;
|
|
84
83
|
scopes?: string[];
|
|
85
84
|
jwksUrl?: string;
|
|
86
|
-
remoteVerify: VerifyAccessTokenRemote;
|
|
87
|
-
/** Maps non-url (ie urn, client) resources to resource_metadata */
|
|
85
|
+
remoteVerify: VerifyAccessTokenRemote; /** Maps non-url (ie urn, client) resources to resource_metadata */
|
|
88
86
|
resourceMetadataMappings?: Record<string, string>;
|
|
89
87
|
};
|
|
90
88
|
type ProtectedResourceMetadataOutput<T> = T extends undefined ? (overrides: ResourceServerMetadata, opts?: {
|
package/dist/client-resource.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as getJwtPlugin, b as handleMcpErrors, o as getOAuthProviderPlugin } from "./utils-
|
|
2
|
-
import { t as PACKAGE_VERSION } from "./version-
|
|
1
|
+
import { a as getJwtPlugin, b as handleMcpErrors, o as getOAuthProviderPlugin } from "./utils-BX7pt3Pi.mjs";
|
|
2
|
+
import { t as PACKAGE_VERSION } from "./version-D0csl_Bb.mjs";
|
|
3
3
|
import { verifyAccessToken } from "better-auth/oauth2";
|
|
4
4
|
import { APIError } from "better-call";
|
|
5
5
|
import { logger } from "@better-auth/core/env";
|
|
@@ -77,7 +77,7 @@ const oauthProviderResourceClient = (auth) => {
|
|
|
77
77
|
if (!resource) throw Error("missing required resource");
|
|
78
78
|
if (oauthProviderOptions?.scopes && opts?.externalScopes && (overrides?.authorization_servers?.length ?? 0) <= 1) throw new BetterAuthError("external scopes should not be provided with one authorization server");
|
|
79
79
|
if (overrides?.scopes_supported) {
|
|
80
|
-
const allValidScopes =
|
|
80
|
+
const allValidScopes = new Set([...oauthProviderOptions?.scopes ?? [], ...opts?.externalScopes ?? []]);
|
|
81
81
|
for (const sc of overrides.scopes_supported) {
|
|
82
82
|
if (sc === "openid") throw new BetterAuthError("Only the Auth Server should utilize the openid scope");
|
|
83
83
|
if ([
|
package/dist/client.d.mts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { n as oauthProvider } from "./oauth-
|
|
1
|
+
import { n as oauthProvider } from "./oauth-C5Ss3rSz.mjs";
|
|
2
|
+
import * as _$_better_fetch_fetch0 from "@better-fetch/fetch";
|
|
3
|
+
|
|
2
4
|
//#region src/client.d.ts
|
|
3
5
|
declare const oauthProviderClient: () => {
|
|
4
6
|
id: "oauth-provider-client";
|
|
@@ -8,7 +10,7 @@ declare const oauthProviderClient: () => {
|
|
|
8
10
|
name: string;
|
|
9
11
|
description: string;
|
|
10
12
|
hooks: {
|
|
11
|
-
onRequest<T extends Record<string, any>>(ctx:
|
|
13
|
+
onRequest<T extends Record<string, any>>(ctx: _$_better_fetch_fetch0.RequestContext<T>): Promise<void>;
|
|
12
14
|
};
|
|
13
15
|
}[];
|
|
14
16
|
$InferServerPlugin: ReturnType<typeof oauthProvider>;
|
package/dist/client.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as buildSignedOAuthQuery, t as PACKAGE_VERSION } from "./version-
|
|
1
|
+
import { n as buildSignedOAuthQuery, t as PACKAGE_VERSION } from "./version-D0csl_Bb.mjs";
|
|
2
2
|
import { safeJSONParse } from "@better-auth/core/utils/json";
|
|
3
3
|
//#region src/client.ts
|
|
4
4
|
const oauthProviderClient = () => {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { _ as Scope, a as OAuthClient, b as Awaitable, c as TokenEndpointAuthMethod, d as OAuthConsent, f as OAuthOpaqueAccessToken, g as SchemaClient, h as Prompt, i as GrantType, l as AuthorizePrompt, m as OAuthRefreshToken, n as AuthServerMetadata, o as OIDCMetadata, p as OAuthOptions, r as BearerMethodsSupported, s as ResourceServerMetadata, t as AuthMethod, u as OAuthAuthorizationQuery, v as StoreTokenType, y as VerificationValue } from "./oauth-
|
|
2
|
-
import { n as oauthProvider, t as getOAuthProviderState } from "./oauth-
|
|
1
|
+
import { _ as Scope, a as OAuthClient, b as Awaitable, c as TokenEndpointAuthMethod, d as OAuthConsent, f as OAuthOpaqueAccessToken, g as SchemaClient, h as Prompt, i as GrantType, l as AuthorizePrompt, m as OAuthRefreshToken, n as AuthServerMetadata, o as OIDCMetadata, p as OAuthOptions, r as BearerMethodsSupported, s as ResourceServerMetadata, t as AuthMethod, u as OAuthAuthorizationQuery, v as StoreTokenType, y as VerificationValue } from "./oauth-D74mBkw6.mjs";
|
|
2
|
+
import { n as oauthProvider, t as getOAuthProviderState } from "./oauth-C5Ss3rSz.mjs";
|
|
3
3
|
import { verifyAccessToken } from "better-auth/oauth2";
|
|
4
4
|
import { JWSAlgorithms, JwtOptions } from "better-auth/plugins";
|
|
5
5
|
import { JWTPayload } from "jose";
|
|
6
6
|
import { GenericEndpointContext } from "@better-auth/core";
|
|
7
|
+
|
|
7
8
|
//#region src/mcp.d.ts
|
|
8
9
|
/**
|
|
9
10
|
* A request middleware handler that checks and responds with
|
|
@@ -11,11 +12,10 @@ import { GenericEndpointContext } from "@better-auth/core";
|
|
|
11
12
|
*
|
|
12
13
|
* @external
|
|
13
14
|
*/
|
|
14
|
-
declare const mcpHandler: (
|
|
15
|
-
|
|
15
|
+
declare const mcpHandler: (/** Resource is the same url as the audience */
|
|
16
|
+
|
|
16
17
|
verifyOptions: Parameters<typeof verifyAccessToken>[1], handler: (req: Request, jwt: JWTPayload) => Awaitable<Response>, opts?: {
|
|
17
|
-
/** Maps non-url (ie urn, client) resources to resource_metadata */
|
|
18
|
-
resourceMetadataMappings: Record<string, string>;
|
|
18
|
+
/** Maps non-url (ie urn, client) resources to resource_metadata */resourceMetadataMappings: Record<string, string>;
|
|
19
19
|
}) => (req: Request) => Promise<Response>;
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region src/metadata.d.ts
|
|
@@ -62,4 +62,4 @@ declare const oauthProviderOpenIdConfigMetadata: <Auth extends {
|
|
|
62
62
|
headers?: HeadersInit;
|
|
63
63
|
}) => (request: Request) => Promise<Response>;
|
|
64
64
|
//#endregion
|
|
65
|
-
export {
|
|
65
|
+
export { AuthMethod, AuthServerMetadata, AuthorizePrompt, BearerMethodsSupported, GrantType, OAuthAuthorizationQuery, OAuthClient, OAuthConsent, OAuthOpaqueAccessToken, OAuthOptions, OAuthRefreshToken, OIDCMetadata, Prompt, ResourceServerMetadata, SchemaClient, Scope, StoreTokenType, TokenEndpointAuthMethod, VerificationValue, authServerMetadata, getOAuthProviderState, mcpHandler, oauthProvider, oauthProviderAuthServerMetadata, oauthProviderOpenIdConfigMetadata, oidcServerMetadata };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as storeToken, a as getJwtPlugin, c as isPKCERequired, d as parsePrompt, f as removePromptFromQuery, g as storeClientSecret, h as searchParamsToQuery, i as getClient, l as normalizeTimestampValue, m as resolveSubjectIdentifier, n as clientAllowsGrant, p as resolveSessionAuthTime, r as decryptStoredClientSecret, s as getStoredToken, t as basicToClientCredentials, u as parseClientMetadata, v as validateClientCredentials, x as mcpHandler, y as verifyOAuthQueryParams } from "./utils-
|
|
2
|
-
import { a as postLoginClearedParam, i as getSignedQueryIssuedAt, o as setSignedOAuthQueryParameterNames, r as canonicalizeOAuthQueryParams, s as signedQueryIssuedAtParam, t as PACKAGE_VERSION } from "./version-
|
|
1
|
+
import { _ as storeToken, a as getJwtPlugin, c as isPKCERequired, d as parsePrompt, f as removePromptFromQuery, g as storeClientSecret, h as searchParamsToQuery, i as getClient, l as normalizeTimestampValue, m as resolveSubjectIdentifier, n as clientAllowsGrant, p as resolveSessionAuthTime, r as decryptStoredClientSecret, s as getStoredToken, t as basicToClientCredentials, u as parseClientMetadata, v as validateClientCredentials, x as mcpHandler, y as verifyOAuthQueryParams } from "./utils-BX7pt3Pi.mjs";
|
|
2
|
+
import { a as postLoginClearedParam, i as getSignedQueryIssuedAt, o as setSignedOAuthQueryParameterNames, r as canonicalizeOAuthQueryParams, s as signedQueryIssuedAtParam, t as PACKAGE_VERSION } from "./version-D0csl_Bb.mjs";
|
|
3
3
|
import { APIError, createAuthEndpoint, createAuthMiddleware, dispatchAuthEndpoint, getOAuthState, getSessionFromCtx, sessionMiddleware } from "better-auth/api";
|
|
4
4
|
import { generateCodeChallenge, getJwks, verifyJwsAccessToken } from "better-auth/oauth2";
|
|
5
5
|
import { APIError as APIError$1 } from "better-call";
|
|
@@ -708,7 +708,7 @@ async function handleClientCredentialsGrant(ctx, opts) {
|
|
|
708
708
|
let requestedScopes = scope?.split(" ");
|
|
709
709
|
if (requestedScopes) {
|
|
710
710
|
const validScopes = new Set(client.scopes ?? opts.scopes);
|
|
711
|
-
const oidcScopes =
|
|
711
|
+
const oidcScopes = new Set([
|
|
712
712
|
"openid",
|
|
713
713
|
"profile",
|
|
714
714
|
"email",
|
|
@@ -2757,7 +2757,7 @@ const getOAuthProviderState = oAuthState.get;
|
|
|
2757
2757
|
const oauthProvider = (options) => {
|
|
2758
2758
|
let clientRegistrationAllowedScopes = options.clientRegistrationAllowedScopes;
|
|
2759
2759
|
if (options.clientRegistrationDefaultScopes) {
|
|
2760
|
-
const _allowedScopes = clientRegistrationAllowedScopes ?
|
|
2760
|
+
const _allowedScopes = clientRegistrationAllowedScopes ? new Set([...clientRegistrationAllowedScopes, ...options.clientRegistrationDefaultScopes]) : new Set([...options.clientRegistrationDefaultScopes]);
|
|
2761
2761
|
clientRegistrationAllowedScopes = Array.from(_allowedScopes);
|
|
2762
2762
|
}
|
|
2763
2763
|
const scopes = new Set((options.scopes ?? [
|
|
@@ -2770,7 +2770,7 @@ const oauthProvider = (options) => {
|
|
|
2770
2770
|
for (const sc of clientRegistrationAllowedScopes) if (!scopes.has(sc)) throw new BetterAuthError(`clientRegistrationAllowedScope ${sc} not found in scopes`);
|
|
2771
2771
|
}
|
|
2772
2772
|
for (const sc of options.advertisedMetadata?.scopes_supported ?? []) if (!scopes?.has(sc)) throw new BetterAuthError(`advertisedMetadata.scopes_supported ${sc} not found in scopes`);
|
|
2773
|
-
const claims =
|
|
2773
|
+
const claims = new Set([
|
|
2774
2774
|
"sub",
|
|
2775
2775
|
"iss",
|
|
2776
2776
|
"aud",
|
|
@@ -2822,7 +2822,7 @@ const oauthProvider = (options) => {
|
|
|
2822
2822
|
issuerPath = new URL(ctx.baseURL).pathname.replace(/\/$/, "") || "";
|
|
2823
2823
|
}
|
|
2824
2824
|
const endpointCtx = { context: ctx };
|
|
2825
|
-
const authServerMetadataPaths =
|
|
2825
|
+
const authServerMetadataPaths = new Set([`/.well-known/oauth-authorization-server${issuerPath}`, `${issuerPath}/.well-known/oauth-authorization-server`]);
|
|
2826
2826
|
const openIdConfigPath = `${issuerPath}/.well-known/openid-configuration`;
|
|
2827
2827
|
const isAuthServerMetadataRequest = authServerMetadataPaths.has(requestPath);
|
|
2828
2828
|
const isOpenIdConfigRequest = opts.scopes?.includes("openid") && requestPath === openIdConfigPath;
|
|
@@ -2977,8 +2977,7 @@ const oauthProvider = (options) => {
|
|
|
2977
2977
|
}
|
|
2978
2978
|
} }
|
|
2979
2979
|
}, async (ctx) => {
|
|
2980
|
-
|
|
2981
|
-
return authorizeEndpoint(ctx, opts, settings);
|
|
2980
|
+
return authorizeEndpoint(ctx, opts, ctx.authorizeSettings ?? { isAuthorize: true });
|
|
2982
2981
|
});
|
|
2983
2982
|
const runOAuth2Authorize = (ctx, settings) => dispatchAuthEndpoint(oauth2AuthorizeEndpoint, {
|
|
2984
2983
|
...ctx,
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { _ as Scope, a as OAuthClient, d as OAuthConsent, n as AuthServerMetadata, o as OIDCMetadata, p as OAuthOptions } from "./oauth-
|
|
1
|
+
import { _ as Scope, a as OAuthClient, d as OAuthConsent, n as AuthServerMetadata, o as OIDCMetadata, p as OAuthOptions } from "./oauth-D74mBkw6.mjs";
|
|
2
|
+
import * as _$better_call0 from "better-call";
|
|
2
3
|
import * as z from "zod";
|
|
4
|
+
import * as _$better_auth_plugins0 from "better-auth/plugins";
|
|
5
|
+
import * as _$jose from "jose";
|
|
6
|
+
import * as _$better_auth0 from "better-auth";
|
|
7
|
+
|
|
3
8
|
//#region src/oauth.d.ts
|
|
4
9
|
declare module "@better-auth/core" {
|
|
5
10
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -24,23 +29,23 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
24
29
|
id: "oauth-provider";
|
|
25
30
|
version: string;
|
|
26
31
|
options: NoInfer<O>;
|
|
27
|
-
init: (ctx:
|
|
28
|
-
onRequest: (request: Request, ctx:
|
|
32
|
+
init: (ctx: _$better_auth0.AuthContext) => void;
|
|
33
|
+
onRequest: (request: Request, ctx: _$better_auth0.AuthContext) => Promise<{
|
|
29
34
|
response: Response;
|
|
30
35
|
} | {
|
|
31
36
|
request: Request;
|
|
32
37
|
} | void>;
|
|
33
38
|
hooks: {
|
|
34
39
|
before: {
|
|
35
|
-
matcher(ctx:
|
|
36
|
-
handler: (inputContext:
|
|
40
|
+
matcher(ctx: _$better_auth0.HookEndpointContext): any;
|
|
41
|
+
handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>;
|
|
37
42
|
}[];
|
|
38
43
|
after: {
|
|
39
|
-
matcher(ctx:
|
|
40
|
-
handler: (inputContext:
|
|
44
|
+
matcher(ctx: _$better_auth0.HookEndpointContext): boolean;
|
|
45
|
+
handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
41
46
|
redirect: boolean;
|
|
42
47
|
url: string;
|
|
43
|
-
} | undefined
|
|
48
|
+
} | undefined>>;
|
|
44
49
|
}[];
|
|
45
50
|
};
|
|
46
51
|
endpoints: {
|
|
@@ -51,7 +56,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
51
56
|
* Provided at /.well-known/oauth-authorization-server/[issuer-path]
|
|
52
57
|
* (root if no issuer-path).
|
|
53
58
|
*/
|
|
54
|
-
getOAuthServerConfig:
|
|
59
|
+
getOAuthServerConfig: _$better_call0.StrictEndpoint<"/.well-known/oauth-authorization-server", {
|
|
55
60
|
method: "GET";
|
|
56
61
|
metadata: {
|
|
57
62
|
SERVER_ONLY: true;
|
|
@@ -64,15 +69,15 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
64
69
|
* Provided at [issuer-path]/.well-known/openid-configuration
|
|
65
70
|
* (root if no issuer-path).
|
|
66
71
|
*/
|
|
67
|
-
getOpenIdConfig:
|
|
72
|
+
getOpenIdConfig: _$better_call0.StrictEndpoint<"/.well-known/openid-configuration", {
|
|
68
73
|
method: "GET";
|
|
69
74
|
metadata: {
|
|
70
75
|
SERVER_ONLY: true;
|
|
71
76
|
};
|
|
72
77
|
}, Omit<OIDCMetadata, "id_token_signing_alg_values_supported"> & {
|
|
73
|
-
id_token_signing_alg_values_supported:
|
|
78
|
+
id_token_signing_alg_values_supported: _$better_auth_plugins0.JWSAlgorithms[] | ["HS256"];
|
|
74
79
|
}>;
|
|
75
|
-
oauth2Authorize:
|
|
80
|
+
oauth2Authorize: _$better_call0.StrictEndpoint<"/oauth2/authorize", {
|
|
76
81
|
method: "GET";
|
|
77
82
|
query: z.ZodObject<{
|
|
78
83
|
response_type: z.ZodOptional<z.ZodEnum<{
|
|
@@ -171,14 +176,14 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
171
176
|
redirect: boolean;
|
|
172
177
|
url: string;
|
|
173
178
|
}>;
|
|
174
|
-
oauth2Consent:
|
|
179
|
+
oauth2Consent: _$better_call0.StrictEndpoint<"/oauth2/consent", {
|
|
175
180
|
method: "POST";
|
|
176
181
|
body: z.ZodObject<{
|
|
177
182
|
accept: z.ZodBoolean;
|
|
178
183
|
scope: z.ZodOptional<z.ZodString>;
|
|
179
184
|
oauth_query: z.ZodOptional<z.ZodString>;
|
|
180
185
|
}, z.core.$strip>;
|
|
181
|
-
use: (
|
|
186
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
182
187
|
session: {
|
|
183
188
|
session: Record<string, any> & {
|
|
184
189
|
id: string;
|
|
@@ -200,7 +205,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
200
205
|
image?: string | null | undefined;
|
|
201
206
|
};
|
|
202
207
|
};
|
|
203
|
-
}
|
|
208
|
+
}>>[];
|
|
204
209
|
metadata: {
|
|
205
210
|
openapi: {
|
|
206
211
|
description: string;
|
|
@@ -233,7 +238,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
233
238
|
redirect: boolean;
|
|
234
239
|
url: string;
|
|
235
240
|
}>;
|
|
236
|
-
oauth2Continue:
|
|
241
|
+
oauth2Continue: _$better_call0.StrictEndpoint<"/oauth2/continue", {
|
|
237
242
|
method: "POST";
|
|
238
243
|
body: z.ZodObject<{
|
|
239
244
|
selected: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -241,7 +246,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
241
246
|
postLogin: z.ZodOptional<z.ZodBoolean>;
|
|
242
247
|
oauth_query: z.ZodOptional<z.ZodString>;
|
|
243
248
|
}, z.core.$strip>;
|
|
244
|
-
use: (
|
|
249
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
245
250
|
session: {
|
|
246
251
|
session: Record<string, any> & {
|
|
247
252
|
id: string;
|
|
@@ -263,7 +268,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
263
268
|
image?: string | null | undefined;
|
|
264
269
|
};
|
|
265
270
|
};
|
|
266
|
-
}
|
|
271
|
+
}>>[];
|
|
267
272
|
metadata: {
|
|
268
273
|
openapi: {
|
|
269
274
|
description: string;
|
|
@@ -293,7 +298,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
293
298
|
redirect: boolean;
|
|
294
299
|
url: string;
|
|
295
300
|
}>;
|
|
296
|
-
oauth2Token:
|
|
301
|
+
oauth2Token: _$better_call0.StrictEndpoint<"/oauth2/token", {
|
|
297
302
|
method: "POST";
|
|
298
303
|
body: z.ZodObject<{
|
|
299
304
|
grant_type: z.ZodEnum<{
|
|
@@ -438,7 +443,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
438
443
|
scope: string;
|
|
439
444
|
id_token: string | undefined;
|
|
440
445
|
}>;
|
|
441
|
-
oauth2Introspect:
|
|
446
|
+
oauth2Introspect: _$better_call0.StrictEndpoint<"/oauth2/introspect", {
|
|
442
447
|
method: "POST";
|
|
443
448
|
body: z.ZodObject<{
|
|
444
449
|
client_id: z.ZodOptional<z.ZodString>;
|
|
@@ -574,8 +579,8 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
574
579
|
};
|
|
575
580
|
};
|
|
576
581
|
};
|
|
577
|
-
},
|
|
578
|
-
oauth2Revoke:
|
|
582
|
+
}, _$jose.JWTPayload>;
|
|
583
|
+
oauth2Revoke: _$better_call0.StrictEndpoint<"/oauth2/revoke", {
|
|
579
584
|
method: "POST";
|
|
580
585
|
body: z.ZodObject<{
|
|
581
586
|
client_id: z.ZodOptional<z.ZodString>;
|
|
@@ -658,7 +663,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
658
663
|
};
|
|
659
664
|
};
|
|
660
665
|
}, null | undefined>;
|
|
661
|
-
oauth2UserInfo:
|
|
666
|
+
oauth2UserInfo: _$better_call0.StrictEndpoint<"/oauth2/userinfo", {
|
|
662
667
|
method: ("GET" | "POST")[];
|
|
663
668
|
metadata: {
|
|
664
669
|
openapi: {
|
|
@@ -779,7 +784,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
779
784
|
family_name?: string | undefined;
|
|
780
785
|
sub: string;
|
|
781
786
|
}>;
|
|
782
|
-
oauth2EndSession:
|
|
787
|
+
oauth2EndSession: _$better_call0.StrictEndpoint<"/oauth2/end-session", {
|
|
783
788
|
method: "GET";
|
|
784
789
|
query: z.ZodObject<{
|
|
785
790
|
id_token_hint: z.ZodString;
|
|
@@ -819,7 +824,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
819
824
|
redirect: boolean;
|
|
820
825
|
url: string;
|
|
821
826
|
} | undefined>;
|
|
822
|
-
registerOAuthClient:
|
|
827
|
+
registerOAuthClient: _$better_call0.StrictEndpoint<"/oauth2/register", {
|
|
823
828
|
method: "POST";
|
|
824
829
|
body: z.ZodObject<{
|
|
825
830
|
redirect_uris: z.ZodArray<z.ZodURL>;
|
|
@@ -867,8 +872,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
867
872
|
content: {
|
|
868
873
|
"application/json": {
|
|
869
874
|
schema: {
|
|
870
|
-
/** @returns {OauthClient} */
|
|
871
|
-
type: "object";
|
|
875
|
+
/** @returns {OauthClient} */type: "object";
|
|
872
876
|
properties: {
|
|
873
877
|
client_id: {
|
|
874
878
|
type: string;
|
|
@@ -993,7 +997,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
993
997
|
};
|
|
994
998
|
};
|
|
995
999
|
}, OAuthClient>;
|
|
996
|
-
adminCreateOAuthClient:
|
|
1000
|
+
adminCreateOAuthClient: _$better_call0.StrictEndpoint<"/admin/oauth2/create-client", {
|
|
997
1001
|
method: "POST";
|
|
998
1002
|
body: z.ZodObject<{
|
|
999
1003
|
redirect_uris: z.ZodArray<z.ZodURL>;
|
|
@@ -1174,9 +1178,9 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
1174
1178
|
};
|
|
1175
1179
|
};
|
|
1176
1180
|
}, OAuthClient>;
|
|
1177
|
-
createOAuthClient:
|
|
1181
|
+
createOAuthClient: _$better_call0.StrictEndpoint<"/oauth2/create-client", {
|
|
1178
1182
|
method: "POST";
|
|
1179
|
-
use: (
|
|
1183
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
1180
1184
|
session: {
|
|
1181
1185
|
session: Record<string, any> & {
|
|
1182
1186
|
id: string;
|
|
@@ -1198,7 +1202,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
1198
1202
|
image?: string | null | undefined;
|
|
1199
1203
|
};
|
|
1200
1204
|
};
|
|
1201
|
-
}
|
|
1205
|
+
}>>[];
|
|
1202
1206
|
body: z.ZodObject<{
|
|
1203
1207
|
redirect_uris: z.ZodArray<z.ZodURL>;
|
|
1204
1208
|
scope: z.ZodOptional<z.ZodString>;
|
|
@@ -1363,9 +1367,9 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
1363
1367
|
};
|
|
1364
1368
|
};
|
|
1365
1369
|
}, OAuthClient>;
|
|
1366
|
-
getOAuthClient:
|
|
1370
|
+
getOAuthClient: _$better_call0.StrictEndpoint<"/oauth2/get-client", {
|
|
1367
1371
|
method: "GET";
|
|
1368
|
-
use: (
|
|
1372
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
1369
1373
|
session: {
|
|
1370
1374
|
session: Record<string, any> & {
|
|
1371
1375
|
id: string;
|
|
@@ -1387,7 +1391,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
1387
1391
|
image?: string | null | undefined;
|
|
1388
1392
|
};
|
|
1389
1393
|
};
|
|
1390
|
-
}
|
|
1394
|
+
}>>[];
|
|
1391
1395
|
query: z.ZodObject<{
|
|
1392
1396
|
client_id: z.ZodString;
|
|
1393
1397
|
}, z.core.$strip>;
|
|
@@ -1397,9 +1401,9 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
1397
1401
|
};
|
|
1398
1402
|
};
|
|
1399
1403
|
}, OAuthClient>;
|
|
1400
|
-
getOAuthClientPublic:
|
|
1404
|
+
getOAuthClientPublic: _$better_call0.StrictEndpoint<"/oauth2/public-client", {
|
|
1401
1405
|
method: "GET";
|
|
1402
|
-
use: (
|
|
1406
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
1403
1407
|
session: {
|
|
1404
1408
|
session: Record<string, any> & {
|
|
1405
1409
|
id: string;
|
|
@@ -1421,7 +1425,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
1421
1425
|
image?: string | null | undefined;
|
|
1422
1426
|
};
|
|
1423
1427
|
};
|
|
1424
|
-
}
|
|
1428
|
+
}>>[];
|
|
1425
1429
|
query: z.ZodObject<{
|
|
1426
1430
|
client_id: z.ZodString;
|
|
1427
1431
|
}, z.core.$strip>;
|
|
@@ -1431,9 +1435,9 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
1431
1435
|
};
|
|
1432
1436
|
};
|
|
1433
1437
|
}, OAuthClient>;
|
|
1434
|
-
getOAuthClientPublicPrelogin:
|
|
1438
|
+
getOAuthClientPublicPrelogin: _$better_call0.StrictEndpoint<"/oauth2/public-client-prelogin", {
|
|
1435
1439
|
method: "POST";
|
|
1436
|
-
use: (
|
|
1440
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>[];
|
|
1437
1441
|
body: z.ZodObject<{
|
|
1438
1442
|
client_id: z.ZodString;
|
|
1439
1443
|
oauth_query: z.ZodOptional<z.ZodString>;
|
|
@@ -1444,9 +1448,9 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
1444
1448
|
};
|
|
1445
1449
|
};
|
|
1446
1450
|
}, OAuthClient>;
|
|
1447
|
-
getOAuthClients:
|
|
1451
|
+
getOAuthClients: _$better_call0.StrictEndpoint<"/oauth2/get-clients", {
|
|
1448
1452
|
method: "GET";
|
|
1449
|
-
use: (
|
|
1453
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
1450
1454
|
session: {
|
|
1451
1455
|
session: Record<string, any> & {
|
|
1452
1456
|
id: string;
|
|
@@ -1468,14 +1472,14 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
1468
1472
|
image?: string | null | undefined;
|
|
1469
1473
|
};
|
|
1470
1474
|
};
|
|
1471
|
-
}
|
|
1475
|
+
}>>[];
|
|
1472
1476
|
metadata: {
|
|
1473
1477
|
openapi: {
|
|
1474
1478
|
description: string;
|
|
1475
1479
|
};
|
|
1476
1480
|
};
|
|
1477
1481
|
}, OAuthClient[] | null>;
|
|
1478
|
-
adminUpdateOAuthClient:
|
|
1482
|
+
adminUpdateOAuthClient: _$better_call0.StrictEndpoint<"/admin/oauth2/update-client", {
|
|
1479
1483
|
method: "PATCH";
|
|
1480
1484
|
body: z.ZodObject<{
|
|
1481
1485
|
client_id: z.ZodString;
|
|
@@ -1518,9 +1522,9 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
1518
1522
|
};
|
|
1519
1523
|
};
|
|
1520
1524
|
}, OAuthClient>;
|
|
1521
|
-
updateOAuthClient:
|
|
1525
|
+
updateOAuthClient: _$better_call0.StrictEndpoint<"/oauth2/update-client", {
|
|
1522
1526
|
method: "POST";
|
|
1523
|
-
use: (
|
|
1527
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
1524
1528
|
session: {
|
|
1525
1529
|
session: Record<string, any> & {
|
|
1526
1530
|
id: string;
|
|
@@ -1542,7 +1546,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
1542
1546
|
image?: string | null | undefined;
|
|
1543
1547
|
};
|
|
1544
1548
|
};
|
|
1545
|
-
}
|
|
1549
|
+
}>>[];
|
|
1546
1550
|
body: z.ZodObject<{
|
|
1547
1551
|
client_id: z.ZodString;
|
|
1548
1552
|
update: z.ZodObject<{
|
|
@@ -1579,9 +1583,9 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
1579
1583
|
};
|
|
1580
1584
|
};
|
|
1581
1585
|
}, OAuthClient>;
|
|
1582
|
-
rotateClientSecret:
|
|
1586
|
+
rotateClientSecret: _$better_call0.StrictEndpoint<"/oauth2/client/rotate-secret", {
|
|
1583
1587
|
method: "POST";
|
|
1584
|
-
use: (
|
|
1588
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
1585
1589
|
session: {
|
|
1586
1590
|
session: Record<string, any> & {
|
|
1587
1591
|
id: string;
|
|
@@ -1603,7 +1607,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
1603
1607
|
image?: string | null | undefined;
|
|
1604
1608
|
};
|
|
1605
1609
|
};
|
|
1606
|
-
}
|
|
1610
|
+
}>>[];
|
|
1607
1611
|
body: z.ZodObject<{
|
|
1608
1612
|
client_id: z.ZodString;
|
|
1609
1613
|
}, z.core.$strip>;
|
|
@@ -1613,9 +1617,9 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
1613
1617
|
};
|
|
1614
1618
|
};
|
|
1615
1619
|
}, OAuthClient>;
|
|
1616
|
-
deleteOAuthClient:
|
|
1620
|
+
deleteOAuthClient: _$better_call0.StrictEndpoint<"/oauth2/delete-client", {
|
|
1617
1621
|
method: "POST";
|
|
1618
|
-
use: (
|
|
1622
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
1619
1623
|
session: {
|
|
1620
1624
|
session: Record<string, any> & {
|
|
1621
1625
|
id: string;
|
|
@@ -1637,7 +1641,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
1637
1641
|
image?: string | null | undefined;
|
|
1638
1642
|
};
|
|
1639
1643
|
};
|
|
1640
|
-
}
|
|
1644
|
+
}>>[];
|
|
1641
1645
|
body: z.ZodObject<{
|
|
1642
1646
|
client_id: z.ZodString;
|
|
1643
1647
|
}, z.core.$strip>;
|
|
@@ -1647,12 +1651,12 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
1647
1651
|
};
|
|
1648
1652
|
};
|
|
1649
1653
|
}, void>;
|
|
1650
|
-
getOAuthConsent:
|
|
1654
|
+
getOAuthConsent: _$better_call0.StrictEndpoint<"/oauth2/get-consent", {
|
|
1651
1655
|
method: "GET";
|
|
1652
1656
|
query: z.ZodObject<{
|
|
1653
1657
|
id: z.ZodString;
|
|
1654
1658
|
}, z.core.$strip>;
|
|
1655
|
-
use: (
|
|
1659
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
1656
1660
|
session: {
|
|
1657
1661
|
session: Record<string, any> & {
|
|
1658
1662
|
id: string;
|
|
@@ -1674,16 +1678,16 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
1674
1678
|
image?: string | null | undefined;
|
|
1675
1679
|
};
|
|
1676
1680
|
};
|
|
1677
|
-
}
|
|
1681
|
+
}>>[];
|
|
1678
1682
|
metadata: {
|
|
1679
1683
|
openapi: {
|
|
1680
1684
|
description: string;
|
|
1681
1685
|
};
|
|
1682
1686
|
};
|
|
1683
1687
|
}, OAuthConsent<Scope[]>>;
|
|
1684
|
-
getOAuthConsents:
|
|
1688
|
+
getOAuthConsents: _$better_call0.StrictEndpoint<"/oauth2/get-consents", {
|
|
1685
1689
|
method: "GET";
|
|
1686
|
-
use: (
|
|
1690
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
1687
1691
|
session: {
|
|
1688
1692
|
session: Record<string, any> & {
|
|
1689
1693
|
id: string;
|
|
@@ -1705,16 +1709,16 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
1705
1709
|
image?: string | null | undefined;
|
|
1706
1710
|
};
|
|
1707
1711
|
};
|
|
1708
|
-
}
|
|
1712
|
+
}>>[];
|
|
1709
1713
|
metadata: {
|
|
1710
1714
|
openapi: {
|
|
1711
1715
|
description: string;
|
|
1712
1716
|
};
|
|
1713
1717
|
};
|
|
1714
1718
|
}, OAuthConsent<Scope[]>[]>;
|
|
1715
|
-
updateOAuthConsent:
|
|
1719
|
+
updateOAuthConsent: _$better_call0.StrictEndpoint<"/oauth2/update-consent", {
|
|
1716
1720
|
method: "POST";
|
|
1717
|
-
use: (
|
|
1721
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
1718
1722
|
session: {
|
|
1719
1723
|
session: Record<string, any> & {
|
|
1720
1724
|
id: string;
|
|
@@ -1736,7 +1740,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
1736
1740
|
image?: string | null | undefined;
|
|
1737
1741
|
};
|
|
1738
1742
|
};
|
|
1739
|
-
}
|
|
1743
|
+
}>>[];
|
|
1740
1744
|
body: z.ZodObject<{
|
|
1741
1745
|
id: z.ZodString;
|
|
1742
1746
|
update: z.ZodObject<{
|
|
@@ -1749,9 +1753,9 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
1749
1753
|
};
|
|
1750
1754
|
};
|
|
1751
1755
|
}, OAuthConsent<Scope[]> | null>;
|
|
1752
|
-
deleteOAuthConsent:
|
|
1756
|
+
deleteOAuthConsent: _$better_call0.StrictEndpoint<"/oauth2/delete-consent", {
|
|
1753
1757
|
method: "POST";
|
|
1754
|
-
use: (
|
|
1758
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
1755
1759
|
session: {
|
|
1756
1760
|
session: Record<string, any> & {
|
|
1757
1761
|
id: string;
|
|
@@ -1773,7 +1777,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
|
|
|
1773
1777
|
image?: string | null | undefined;
|
|
1774
1778
|
};
|
|
1775
1779
|
};
|
|
1776
|
-
}
|
|
1780
|
+
}>>[];
|
|
1777
1781
|
body: z.ZodObject<{
|
|
1778
1782
|
id: z.ZodString;
|
|
1779
1783
|
}, z.core.$strip>;
|
|
@@ -2,6 +2,7 @@ import { JWSAlgorithms } from "better-auth/plugins";
|
|
|
2
2
|
import { JWTPayload } from "jose";
|
|
3
3
|
import { InferOptionSchema, Session, User } from "better-auth/types";
|
|
4
4
|
import { GenericEndpointContext, LiteralString } from "@better-auth/core";
|
|
5
|
+
|
|
5
6
|
//#region src/schema.d.ts
|
|
6
7
|
declare const schema: {
|
|
7
8
|
oauthClient: {
|
|
@@ -397,7 +398,7 @@ interface OAuthOptions<Scopes extends readonly Scope[] = InternallySupportedScop
|
|
|
397
398
|
* @example
|
|
398
399
|
* { "write:payments": "5m", "read:payments": "30m" }
|
|
399
400
|
*/
|
|
400
|
-
scopeExpirations?: { [K in Scopes[number]]?: number | string | Date
|
|
401
|
+
scopeExpirations?: { [K in Scopes[number]]?: number | string | Date };
|
|
401
402
|
/**
|
|
402
403
|
* Allows /oauth2/public-client-prelogin endpoint to be
|
|
403
404
|
* requestable prior to login via a valid oauth_query.
|
|
@@ -721,12 +722,10 @@ interface OAuthOptions<Scopes extends readonly Scope[] = InternallySupportedScop
|
|
|
721
722
|
* @returns Additional claims for userinfo request
|
|
722
723
|
*/
|
|
723
724
|
customUserInfoClaims?: (info: {
|
|
724
|
-
/** The user object */
|
|
725
|
-
user: User & Record<string, unknown>;
|
|
725
|
+
/** The user object */user: User & Record<string, unknown>;
|
|
726
726
|
/** The scopes from the access token used
|
|
727
727
|
* in the /userinfo request (matches jwt.scopes) */
|
|
728
|
-
scopes: Scopes;
|
|
729
|
-
/** The access token payload used in the /userinfo request */
|
|
728
|
+
scopes: Scopes; /** The access token payload used in the /userinfo request */
|
|
730
729
|
jwt: JWTPayload;
|
|
731
730
|
}) => Awaitable<Record<string, any>>;
|
|
732
731
|
/**
|
|
@@ -740,11 +739,8 @@ interface OAuthOptions<Scopes extends readonly Scope[] = InternallySupportedScop
|
|
|
740
739
|
* @param info - context that may be useful when creating custom claims
|
|
741
740
|
*/
|
|
742
741
|
customIdTokenClaims?: (info: {
|
|
743
|
-
/** The user object if token is associated to a user. */
|
|
744
|
-
|
|
745
|
-
/** Scopes granted for this token */
|
|
746
|
-
scopes: Scopes;
|
|
747
|
-
/** oAuthClient metadata */
|
|
742
|
+
/** The user object if token is associated to a user. */user: User & Record<string, unknown>; /** Scopes granted for this token */
|
|
743
|
+
scopes: Scopes; /** oAuthClient metadata */
|
|
748
744
|
metadata?: Record<string, any>;
|
|
749
745
|
}) => Awaitable<Record<string, any>>;
|
|
750
746
|
/**
|
|
@@ -761,15 +757,10 @@ interface OAuthOptions<Scopes extends readonly Scope[] = InternallySupportedScop
|
|
|
761
757
|
* @param info - context that may be useful when creating custom claims
|
|
762
758
|
*/
|
|
763
759
|
customAccessTokenClaims?: (info: {
|
|
764
|
-
/** The user object if token is associated to a user. Null if user doesn't exist. Undefined if user not applicable. */
|
|
765
|
-
|
|
766
|
-
/**
|
|
767
|
-
|
|
768
|
-
/** Scopes granted for this token */
|
|
769
|
-
scopes: Scopes;
|
|
770
|
-
/** The resource requesting. Provided by the token endpoint. */
|
|
771
|
-
resource?: string;
|
|
772
|
-
/** oAuthClient metadata */
|
|
760
|
+
/** The user object if token is associated to a user. Null if user doesn't exist. Undefined if user not applicable. */user?: (User & Record<string, unknown>) | null; /** reference of the consent/authorization */
|
|
761
|
+
referenceId?: string; /** Scopes granted for this token */
|
|
762
|
+
scopes: Scopes; /** The resource requesting. Provided by the token endpoint. */
|
|
763
|
+
resource?: string; /** oAuthClient metadata */
|
|
773
764
|
metadata?: Record<string, any>;
|
|
774
765
|
}) => Awaitable<Record<string, any>>;
|
|
775
766
|
/**
|
|
@@ -784,17 +775,14 @@ interface OAuthOptions<Scopes extends readonly Scope[] = InternallySupportedScop
|
|
|
784
775
|
* @param info - context that may be useful when creating custom fields
|
|
785
776
|
*/
|
|
786
777
|
customTokenResponseFields?: (info: {
|
|
787
|
-
/** The grant type being processed */
|
|
788
|
-
grantType: GrantType;
|
|
778
|
+
/** The grant type being processed */grantType: GrantType;
|
|
789
779
|
/**
|
|
790
780
|
* The user, if applicable.
|
|
791
781
|
* Undefined for `client_credentials` (M2M, no user).
|
|
792
782
|
* Always present for `authorization_code` and `refresh_token`.
|
|
793
783
|
*/
|
|
794
|
-
user?: (User & Record<string, unknown>) | null;
|
|
795
|
-
|
|
796
|
-
scopes: Scopes;
|
|
797
|
-
/** oAuthClient metadata */
|
|
784
|
+
user?: (User & Record<string, unknown>) | null; /** Scopes granted for this token */
|
|
785
|
+
scopes: Scopes; /** oAuthClient metadata */
|
|
798
786
|
metadata?: Record<string, any>;
|
|
799
787
|
/**
|
|
800
788
|
* The authorization code verification value.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as canonicalizeOAuthQueryParams } from "./version-
|
|
1
|
+
import { r as canonicalizeOAuthQueryParams } from "./version-D0csl_Bb.mjs";
|
|
2
2
|
import { isAPIError } from "better-auth/api";
|
|
3
3
|
import { verifyAccessToken } from "better-auth/oauth2";
|
|
4
4
|
import { APIError as APIError$1 } from "better-call";
|
|
@@ -16,7 +16,7 @@ function canonicalizeOAuthQueryParams(params) {
|
|
|
16
16
|
}
|
|
17
17
|
function setSignedOAuthQueryParameterNames(params) {
|
|
18
18
|
params.delete(signedQueryParameterNameParam);
|
|
19
|
-
const signedParameterNames = [
|
|
19
|
+
const signedParameterNames = [...new Set([...params.keys(), signedQueryParameterNameParam])].sort();
|
|
20
20
|
for (const parameterName of signedParameterNames) params.append(signedQueryParameterNameParam, parameterName);
|
|
21
21
|
}
|
|
22
22
|
function getSignedOAuthQueryParameterNames(params) {
|
|
@@ -42,6 +42,6 @@ function getSignedQueryIssuedAt(oauthQuery) {
|
|
|
42
42
|
}
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region src/version.ts
|
|
45
|
-
const PACKAGE_VERSION = "1.6.
|
|
45
|
+
const PACKAGE_VERSION = "1.6.28";
|
|
46
46
|
//#endregion
|
|
47
47
|
export { postLoginClearedParam as a, getSignedQueryIssuedAt as i, buildSignedOAuthQuery as n, setSignedOAuthQueryParameterNames as o, canonicalizeOAuthQueryParams as r, signedQueryIssuedAtParam as s, PACKAGE_VERSION as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/oauth-provider",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.28",
|
|
4
4
|
"description": "An oauth provider plugin for Better Auth",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -63,16 +63,16 @@
|
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
65
65
|
"listhen": "^1.9.0",
|
|
66
|
-
"tsdown": "0.
|
|
67
|
-
"@better-auth/core": "1.6.
|
|
68
|
-
"better-auth": "1.6.
|
|
66
|
+
"tsdown": "0.21.10",
|
|
67
|
+
"@better-auth/core": "1.6.28",
|
|
68
|
+
"better-auth": "1.6.28"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"@better-auth/utils": "0.4.2",
|
|
72
72
|
"@better-fetch/fetch": "1.3.1",
|
|
73
|
-
"better-call": "1.
|
|
74
|
-
"@better-auth/core": "^1.6.
|
|
75
|
-
"better-auth": "^1.6.
|
|
73
|
+
"better-call": "1.4.0",
|
|
74
|
+
"@better-auth/core": "^1.6.28",
|
|
75
|
+
"better-auth": "^1.6.28"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
78
|
"build": "tsdown",
|