@better-auth/oauth-provider 1.7.0-beta.6 → 1.7.0-beta.8
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 +1 -1
- package/dist/client-resource.mjs +1 -1
- package/dist/client.d.mts +1 -1
- package/dist/client.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{introspect-BXqKFUQZ.mjs → introspect-BXNvkz8S.mjs} +5 -1
- package/dist/{oauth-CaXmZpoL.d.mts → oauth-CPWY2Few.d.mts} +7 -0
- package/dist/{oauth-CAeemjD7.d.mts → oauth-CqOygaZd.d.mts} +1 -1
- package/dist/{version-CUu3vBtU.mjs → version-bmpg6tAD.mjs} +1 -1
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as ResourceServerMetadata } from "./oauth-
|
|
1
|
+
import { c as ResourceServerMetadata } from "./oauth-CPWY2Few.mjs";
|
|
2
2
|
import { ResourceRequestInput, VerifyAccessTokenRequestOptions } from "better-auth/oauth2";
|
|
3
3
|
import { JWTPayload, JWTVerifyOptions } from "jose";
|
|
4
4
|
import { BetterAuthOptions } from "better-auth/types";
|
package/dist/client-resource.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { o as getJwtPlugin, s as getOAuthProviderPlugin } from "./utils-Baq6atYN.mjs";
|
|
2
|
-
import { t as PACKAGE_VERSION } from "./version-
|
|
2
|
+
import { t as PACKAGE_VERSION } from "./version-bmpg6tAD.mjs";
|
|
3
3
|
import { t as raiseResourceServerChallenge } from "./resource-challenge-B-cqv4ur.mjs";
|
|
4
4
|
import { APIError } from "better-call";
|
|
5
5
|
import { logger } from "@better-auth/core/env";
|
package/dist/client.d.mts
CHANGED
package/dist/client.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as buildSignedOAuthQuery } from "./signed-query-CFv2jNMT.mjs";
|
|
2
|
-
import { t as PACKAGE_VERSION } from "./version-
|
|
2
|
+
import { t as PACKAGE_VERSION } from "./version-bmpg6tAD.mjs";
|
|
3
3
|
import { safeJSONParse } from "@better-auth/core/utils/json";
|
|
4
4
|
//#region src/client.ts
|
|
5
5
|
const oauthProviderClient = () => {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as OAuthProviderExtension, B as StoreTokenType, C as OAuthConsent, D as OAuthOpaqueAccessToken, E as OAuthMetadataExtensionInput, F as OAuthTokenResponse, H as ClientRegistrationRequest, I as OAuthUserInfoExtensionInput, L as Prompt, M as OAuthResource, N as OAuthResourceInput, O as OAuthOptions, P as OAuthTokenIssueParams, R as SchemaClient, S as OAuthClientResource, T as OAuthExtensionGrantHandlerInput, U as ResourceUriSchema, V as VerificationValue, _ as OAuthClaimExtensionInput, a as GrantType, b as OAuthClientAuthenticationResult, c as ResourceServerMetadata, d as ActiveAccessTokenPayload, f as AuthorizePrompt, g as OAuthAuthorizationQuery, h as OAuthAuthenticatedClient, i as Confirmation, j as OAuthRefreshToken, k as OAuthProviderApi, l as TokenEndpointAuthMethod, m as InitialAccessTokenAuthorization, n as AuthServerMetadata, o as OAuthClient, p as ClientDiscovery, r as BearerMethodsSupported, s as OIDCMetadata, t as AuthMethod, u as TokenType, v as OAuthClientAuthenticationInput, w as OAuthExtensionGrantHandler, x as OAuthClientAuthenticationStrategy, y as OAuthClientAuthenticationRequest, z as Scope } from "./oauth-
|
|
2
|
-
import { a as OAuthEndpointErrorResult, c as OAuthFieldErrorCode, i as getIssuer, l as OAuthFieldErrorCodeMap, n as getOAuthProviderState, o as OAuthEndpointRedirectContext, r as oauthProvider, s as OAuthErrorCode, t as DEFAULT_OAUTH_SCOPES, u as OAuthRedirectOnError } from "./oauth-
|
|
1
|
+
import { A as OAuthProviderExtension, B as StoreTokenType, C as OAuthConsent, D as OAuthOpaqueAccessToken, E as OAuthMetadataExtensionInput, F as OAuthTokenResponse, H as ClientRegistrationRequest, I as OAuthUserInfoExtensionInput, L as Prompt, M as OAuthResource, N as OAuthResourceInput, O as OAuthOptions, P as OAuthTokenIssueParams, R as SchemaClient, S as OAuthClientResource, T as OAuthExtensionGrantHandlerInput, U as ResourceUriSchema, V as VerificationValue, _ as OAuthClaimExtensionInput, a as GrantType, b as OAuthClientAuthenticationResult, c as ResourceServerMetadata, d as ActiveAccessTokenPayload, f as AuthorizePrompt, g as OAuthAuthorizationQuery, h as OAuthAuthenticatedClient, i as Confirmation, j as OAuthRefreshToken, k as OAuthProviderApi, l as TokenEndpointAuthMethod, m as InitialAccessTokenAuthorization, n as AuthServerMetadata, o as OAuthClient, p as ClientDiscovery, r as BearerMethodsSupported, s as OIDCMetadata, t as AuthMethod, u as TokenType, v as OAuthClientAuthenticationInput, w as OAuthExtensionGrantHandler, x as OAuthClientAuthenticationStrategy, y as OAuthClientAuthenticationRequest, z as Scope } from "./oauth-CPWY2Few.mjs";
|
|
2
|
+
import { a as OAuthEndpointErrorResult, c as OAuthFieldErrorCode, i as getIssuer, l as OAuthFieldErrorCodeMap, n as getOAuthProviderState, o as OAuthEndpointRedirectContext, r as oauthProvider, s as OAuthErrorCode, t as DEFAULT_OAUTH_SCOPES, u as OAuthRedirectOnError } from "./oauth-CqOygaZd.mjs";
|
|
3
3
|
import { getSessionFromCtx } from "better-auth/api";
|
|
4
4
|
import { JWSAlgorithms, JwtOptions } from "better-auth/plugins";
|
|
5
5
|
import { AuthContext, GenericEndpointContext } from "@better-auth/core";
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { D as applyOAuthProviderMetadataExtensions, E as verifyOAuthQueryParams, F as getSupportedGrantTypes, L as isExtensionTokenEndpointAuthMethod, M as getClientDiscoveries, P as getSupportedAuthMethods, R as validateOAuthProviderExtensions, S as storeToken, T as validateClientCredentials, _ as removePromptFromQuery, a as getClient, b as searchParamsToQuery, c as getStoredToken, d as mergeDiscoveryMetadata, g as removeMaxAgeFromQuery, h as parsePrompt, i as extractClientCredentials, j as extendOAuthProvider, l as isPKCERequired, m as parseClientMetadata, n as decryptStoredClientSecret, o as getJwtPlugin, p as parseBearerToken, r as destructureCredentials, t as clientAllowsGrant, u as isSessionFreshForSignedQuery, w as toResourceList, x as storeClientSecret, y as resolveSubjectIdentifier } from "./utils-Baq6atYN.mjs";
|
|
2
2
|
import { a as setSignedOAuthQueryParameterNames, i as postLoginClearedParam, n as canonicalizeOAuthQueryParams, o as signedQueryIssuedAtParam, r as getSignedQueryIssuedAt } from "./signed-query-CFv2jNMT.mjs";
|
|
3
|
-
import { _ as invalidateResourceCache, a as invalidateRefreshFamily, b as resolveResourcePolicy, c as ResourceUriSchema, d as clientRegistrationRequestSchema, f as JWS_ALGORITHMS, g as getResource, h as extractRepeatedResourceFromForm, i as getOAuthProviderApi, l as SafeUrlSchema, m as buildClientResourceLinkId, o as tokenEndpoint, p as assertIdentifierValid, r as decodeRefreshToken, s as userInfoEndpoint, t as introspectEndpoint, u as authorizationQuerySchema, v as isAudienceClaimAllowed, x as seedResources, y as logEnforcePerClientResourcesResolution } from "./introspect-
|
|
3
|
+
import { _ as invalidateResourceCache, a as invalidateRefreshFamily, b as resolveResourcePolicy, c as ResourceUriSchema, d as clientRegistrationRequestSchema, f as JWS_ALGORITHMS, g as getResource, h as extractRepeatedResourceFromForm, i as getOAuthProviderApi, l as SafeUrlSchema, m as buildClientResourceLinkId, o as tokenEndpoint, p as assertIdentifierValid, r as decodeRefreshToken, s as userInfoEndpoint, t as introspectEndpoint, u as authorizationQuerySchema, v as isAudienceClaimAllowed, x as seedResources, y as logEnforcePerClientResourcesResolution } from "./introspect-BXNvkz8S.mjs";
|
|
4
4
|
import { n as consumeClientAssertion, r as isPrivateHostname } from "./client-assertion-CctbJywV.mjs";
|
|
5
|
-
import { t as PACKAGE_VERSION } from "./version-
|
|
5
|
+
import { t as PACKAGE_VERSION } from "./version-bmpg6tAD.mjs";
|
|
6
6
|
import { t as raiseResourceServerChallenge } from "./resource-challenge-B-cqv4ur.mjs";
|
|
7
7
|
import { isBrowserFetchRequest } from "@better-auth/core/utils/fetch-metadata";
|
|
8
8
|
import { isLoopbackHost, isLoopbackIP } from "@better-auth/core/utils/host";
|
|
@@ -72,7 +72,7 @@ function stripReservedClaims(claims) {
|
|
|
72
72
|
* always win.
|
|
73
73
|
*/
|
|
74
74
|
async function resolveAccessTokenClaims(input) {
|
|
75
|
-
const { ctx, opts, user, client, scopes, resources, referenceId, metadata, grantType, perRequestClaims, resourcePolicyClaims } = input;
|
|
75
|
+
const { ctx, opts, user, client, scopes, resources, referenceId, metadata, grantType, sessionId, perRequestClaims, resourcePolicyClaims } = input;
|
|
76
76
|
const extensionClaims = await collectExtensionAccessTokenClaims(opts, {
|
|
77
77
|
ctx,
|
|
78
78
|
opts,
|
|
@@ -81,6 +81,7 @@ async function resolveAccessTokenClaims(input) {
|
|
|
81
81
|
scopes,
|
|
82
82
|
grantType,
|
|
83
83
|
referenceId,
|
|
84
|
+
sessionId,
|
|
84
85
|
resources,
|
|
85
86
|
metadata
|
|
86
87
|
});
|
|
@@ -1452,6 +1453,7 @@ async function createUserTokens(ctx, opts, params) {
|
|
|
1452
1453
|
scopes: effectiveScopes,
|
|
1453
1454
|
grantType,
|
|
1454
1455
|
referenceId,
|
|
1456
|
+
sessionId,
|
|
1455
1457
|
resources: params.resources,
|
|
1456
1458
|
metadata
|
|
1457
1459
|
}),
|
|
@@ -1483,6 +1485,7 @@ async function createUserTokens(ctx, opts, params) {
|
|
|
1483
1485
|
client,
|
|
1484
1486
|
scopes: effectiveScopes,
|
|
1485
1487
|
grantType,
|
|
1488
|
+
sessionId,
|
|
1486
1489
|
resources: params.resources,
|
|
1487
1490
|
referenceId,
|
|
1488
1491
|
metadata,
|
|
@@ -1940,6 +1943,7 @@ async function validateOpaqueAccessToken(ctx, opts, token, clientId) {
|
|
|
1940
1943
|
client,
|
|
1941
1944
|
scopes: accessToken.scopes ?? [],
|
|
1942
1945
|
grantType: void 0,
|
|
1946
|
+
sessionId: void 0,
|
|
1943
1947
|
resources,
|
|
1944
1948
|
referenceId: accessToken.referenceId,
|
|
1945
1949
|
metadata: parseClientMetadata(client.metadata),
|
|
@@ -849,6 +849,13 @@ interface OAuthClaimExtensionInput {
|
|
|
849
849
|
scopes: string[];
|
|
850
850
|
grantType?: GrantType;
|
|
851
851
|
referenceId?: string;
|
|
852
|
+
/**
|
|
853
|
+
* Session the tokens are issued for, when one is available. Best-effort:
|
|
854
|
+
* set on the session-backed grants (authorization_code, refresh_token),
|
|
855
|
+
* undefined otherwise (client_credentials, introspection, or a session that
|
|
856
|
+
* was deleted or unlinked). Treat as possibly undefined.
|
|
857
|
+
*/
|
|
858
|
+
sessionId?: string;
|
|
852
859
|
resources?: string[];
|
|
853
860
|
/** Parsed client metadata, as returned by `parseClientMetadata`. */
|
|
854
861
|
metadata?: Record<string, unknown>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as OAuthConsent, F as OAuthTokenResponse, L as Prompt, M as OAuthResource, O as OAuthOptions, a as GrantType, l as TokenEndpointAuthMethod, n as AuthServerMetadata, o as OAuthClient, z as Scope } from "./oauth-
|
|
1
|
+
import { C as OAuthConsent, F as OAuthTokenResponse, L as Prompt, M as OAuthResource, O as OAuthOptions, a as GrantType, l as TokenEndpointAuthMethod, n as AuthServerMetadata, o as OAuthClient, z as Scope } from "./oauth-CPWY2Few.mjs";
|
|
2
2
|
import * as better_call0 from "better-call";
|
|
3
3
|
import * as z from "zod";
|
|
4
4
|
import * as jose from "jose";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/oauth-provider",
|
|
3
|
-
"version": "1.7.0-beta.
|
|
3
|
+
"version": "1.7.0-beta.8",
|
|
4
4
|
"description": "An oauth provider plugin for Better Auth",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -63,15 +63,15 @@
|
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"listhen": "^1.9.0",
|
|
65
65
|
"tsdown": "0.21.1",
|
|
66
|
-
"@better-auth/core": "1.7.0-beta.
|
|
67
|
-
"better-auth": "1.7.0-beta.
|
|
66
|
+
"@better-auth/core": "1.7.0-beta.8",
|
|
67
|
+
"better-auth": "1.7.0-beta.8"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"@better-auth/utils": "0.4.2",
|
|
71
71
|
"@better-fetch/fetch": "1.3.1",
|
|
72
72
|
"better-call": "1.3.6",
|
|
73
|
-
"@better-auth/core": "^1.7.0-beta.
|
|
74
|
-
"better-auth": "^1.7.0-beta.
|
|
73
|
+
"@better-auth/core": "^1.7.0-beta.8",
|
|
74
|
+
"better-auth": "^1.7.0-beta.8"
|
|
75
75
|
},
|
|
76
76
|
"scripts": {
|
|
77
77
|
"build": "tsdown",
|