@iqauth/sdk 2.1.0 → 2.3.0
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/README.md +43 -3
- package/dist/browser-session.d.mts +1 -2
- package/dist/browser-session.d.ts +1 -2
- package/dist/browser-session.js +89 -68
- package/dist/browser-session.mjs +2 -1
- package/dist/browser.d.mts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +69 -7
- package/dist/browser.mjs +2 -2
- package/dist/{chunk-ZESHDJDU.mjs → chunk-EKTNEZIH.mjs} +5 -8
- package/dist/{chunk-JQRTY5MY.mjs → chunk-KGEPDXHU.mjs} +12 -8
- package/dist/{chunk-S3M2IXCE.mjs → chunk-RACIPVLD.mjs} +15 -9
- package/dist/chunk-UNYDG2L4.mjs +209 -0
- package/dist/{chunk-MDUHPQMM.mjs → chunk-W3F4JYGP.mjs} +8 -180
- package/dist/chunk-WQWBJSSS.mjs +119 -0
- package/dist/cli/index.js +21 -0
- package/dist/cli/index.mjs +1 -1
- package/dist/{client-DXbHb2ul.d.ts → client-DTX4hNdS.d.ts} +16 -21
- package/dist/{client-Dv4v92Mj.d.mts → client-vdh2a9fJ.d.mts} +16 -21
- package/dist/{doctor-OHJRZBBT.mjs → doctor-A5E7LSFW.mjs} +2 -1
- package/dist/{express-BZmF1llh.d.mts → express-A0-dWEMy.d.mts} +1 -1
- package/dist/{express-B4o3P8vK.d.ts → express-Bo_pJKHN.d.ts} +1 -1
- package/dist/express.d.mts +75 -5
- package/dist/express.d.ts +75 -5
- package/dist/express.js +353 -94
- package/dist/express.mjs +210 -12
- package/dist/fastify.js +153 -88
- package/dist/fastify.mjs +10 -9
- package/dist/hono.js +152 -88
- package/dist/hono.mjs +9 -9
- package/dist/index.d.mts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +148 -72
- package/dist/index.mjs +16 -12
- package/dist/mobile.d.mts +1 -2
- package/dist/mobile.d.ts +1 -2
- package/dist/mobile.js +89 -68
- package/dist/mobile.mjs +2 -1
- package/dist/next.d.mts +9 -0
- package/dist/next.d.ts +9 -0
- package/dist/next.js +164 -1649
- package/dist/next.mjs +13 -16
- package/dist/{publishableKey-B5DIK81A.d.mts → publishableKey-BaR0HoAH.d.mts} +10 -1
- package/dist/{publishableKey-B5DIK81A.d.ts → publishableKey-BaR0HoAH.d.ts} +10 -1
- package/dist/react.d.mts +35 -3
- package/dist/react.d.ts +35 -3
- package/dist/react.js +78 -18
- package/dist/react.mjs +14 -2
- package/dist/server/handlers.d.mts +2 -0
- package/dist/server/handlers.d.ts +2 -0
- package/dist/server/handlers.js +72 -17
- package/dist/server/handlers.mjs +3 -2
- package/dist/server.d.mts +2 -3
- package/dist/server.d.ts +2 -3
- package/dist/server.js +151 -89
- package/dist/server.mjs +7 -6
- package/dist/service.d.mts +1 -2
- package/dist/service.d.ts +1 -2
- package/dist/service.js +89 -68
- package/dist/service.mjs +2 -1
- package/dist/{signIn-CEMdUAwd.d.mts → signIn-Cd0P4y9d.d.mts} +9 -1
- package/dist/{signIn-VRNzlNyG.d.ts → signIn-DKakyzeu.d.ts} +9 -1
- package/package.json +3 -2
- package/dist/chunk-5WFR6Y33.mjs +0 -59
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { I as IQAuthEnvironment, T as TokenPair, W as IQAuthRetryConfig, L as LoginResult, a$ as SignupRequest, D as MfaVerifyResult, d as SessionUser, J as JwtClaims, h as Session, U as UserProfile, H as ProvisionUserRequest, K as ProvisionUserResponse, G as UserPermissions, O as OidcDiscovery, t as JwksResponse, u as OidcTokenResponse, b0 as HostedClientContext, i as TenantInfo, C as CreateTenantRequest, j as UpdateTenantRequest, P as PromoteToVendorRequest, k as PromoteToVendorResult, a7 as TenantUser, l as InviteTenantUserRequest, m as InviteTenantUserResult, n as TenantUserRoleUpdate, M as MigrateUserRequest, E as PasswordPolicy, F as MfaPolicy, B as BrandingConfig, _ as AppInfo, $ as PermissionNodeInfo, Z as AppManifest, a0 as AppSyncResult, a1 as Role, a2 as CreateRoleRequest, a3 as UpdateRoleRequest, a4 as AssignRoleRequest, a5 as UserRoleAssignment, a8 as PermissionGroup, a9 as GroupPermission, aa as AddGroupPermissionRequest, ab as InheritanceRelation, a6 as UserGroupAssignment, ac as UserPermissionOverride, ad as AddUserOverrideRequest, ae as EffectivePermission, af as PermissionCheckResult, ah as CreateApiKeyRequest, ai as CreateApiKeyResult, ag as ApiKeyInfo, aj as ApiKeyIntrospection, al as CreateInviteRequest, ak as Invitation, am as InviteValidation, an as AcceptInviteRequest, ap as CreateWebhookRequest, aq as CreateWebhookResult, ao as WebhookEndpoint, ar as WebhookDelivery, as as WebhookTestResult, at as Entitlement, au as GrantEntitlementRequest, av as Vendor, aw as CreateVendorRequest, ax as UpdateVendorRequest, az as CreateSourceRequest, ay as Source, aA as UpdateSourceRequest, aC as CreateClientRequest, aB as Client, aD as UpdateClientRequest, aE as HierarchyVendor, aH as HierarchyLink, aL as MembershipWithDetails, aJ as CreateMembershipRequest, aI as Membership, aK as UpdateMembershipRequest, aM as AvailableScopesTree, aQ as ScopeSwitchResult, aR as GdprExportData, aS as PinStatus, aU as MfaAvailableMethods, aV as TotpEnrollResult, aW as TotpVerifyResult, aX as SmsEnrollResult, y as MfaEnrollment, aY as EmailEnrollResult, aZ as BackupCodesResult, a_ as BackupCodeCountResult, o as UpdateBrandingRequest, q as UploadAssetRequest, p as BrandingAsset, r as BrandingDomainMapping, a as IQAuthClientConfig, c as IQAuthBrowserSessionClientConfig, b as IQAuthTokenClientConfig } from './types-Cxl3bQHt.mjs';
|
|
2
|
-
import jwt from 'jsonwebtoken';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* SOURCE REFS:
|
|
@@ -90,6 +89,14 @@ declare class AuthModule {
|
|
|
90
89
|
* - Route file: src/lib/crypto.ts (key rotation with kid)
|
|
91
90
|
* - Verified claims: sub, email, name, tenantId, vendorId, roles, entitlements, sessionId, jti, iss, aud, exp, iat, scopeContext, loginMethod
|
|
92
91
|
* - Last verified: Phase 0 Research Summary
|
|
92
|
+
*
|
|
93
|
+
* 2.3.0: Verify path swapped from `jsonwebtoken` (which depends on
|
|
94
|
+
* `node:crypto`) to `jose` so the SDK works on Next.js / Vercel / Cloudflare
|
|
95
|
+
* edge runtimes. Edge has only Web Crypto, so every call from a Next
|
|
96
|
+
* middleware previously threw and was wrapped as `TOKEN_INVALID`,
|
|
97
|
+
* indistinguishable from a real bad token. We keep our own JWKS fetch +
|
|
98
|
+
* cache to preserve INTERNAL_ERROR mapping for malformed JWKS payloads and
|
|
99
|
+
* to keep the kid-aware "Unknown key ID" diagnostic.
|
|
93
100
|
*/
|
|
94
101
|
|
|
95
102
|
declare const DEFAULT_TOKEN_ISSUER: string[];
|
|
@@ -99,7 +106,7 @@ interface TokenVerifyOptions {
|
|
|
99
106
|
issuer?: string | string[];
|
|
100
107
|
audience?: string | string[];
|
|
101
108
|
clockTolerance?: number;
|
|
102
|
-
algorithms?:
|
|
109
|
+
algorithms?: string[];
|
|
103
110
|
}
|
|
104
111
|
interface TokensModuleOptions {
|
|
105
112
|
issuer?: string | string[];
|
|
@@ -115,34 +122,22 @@ declare class TokensModule {
|
|
|
115
122
|
private defaultClockTolerance;
|
|
116
123
|
constructor(baseUrl: string, options?: TokensModuleOptions);
|
|
117
124
|
/**
|
|
118
|
-
* Verify a JWT access token using RS256 via JWKS from
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* clock tolerance default to client config but can be overridden per call.
|
|
125
|
+
* Verify a JWT access token using RS256/ES256 via JWKS from
|
|
126
|
+
* `/.well-known/jwks.json`. Backed by `jose` (Web Crypto) so it runs on
|
|
127
|
+
* Node, browser, and edge runtimes alike — no `node:crypto` dependency.
|
|
128
|
+
* Caches JWKS for 1 hour and refetches once on unknown `kid`.
|
|
123
129
|
*/
|
|
124
130
|
verify(token: string, options?: TokenVerifyOptions): Promise<JwtClaims>;
|
|
125
131
|
/**
|
|
126
132
|
* Decode a JWT without verification. Returns null if malformed.
|
|
127
|
-
*
|
|
128
|
-
* @remarks Local decode only — no network call
|
|
129
133
|
*/
|
|
130
134
|
decode(token: string): JwtClaims | null;
|
|
131
|
-
/**
|
|
132
|
-
* Check if a token is expired based on the `exp` claim.
|
|
133
|
-
*
|
|
134
|
-
* @remarks Local check only — no network call
|
|
135
|
-
*/
|
|
135
|
+
/** Check if a token is expired based on the `exp` claim. */
|
|
136
136
|
isExpired(token: string): boolean;
|
|
137
|
-
/**
|
|
138
|
-
* Get the claims from a token without verification.
|
|
139
|
-
*
|
|
140
|
-
* @remarks Local decode only — no network call
|
|
141
|
-
*/
|
|
137
|
+
/** Get the claims from a token without verification. */
|
|
142
138
|
getClaims(token: string): JwtClaims;
|
|
143
|
-
private
|
|
139
|
+
private ensureCache;
|
|
144
140
|
private refreshJwks;
|
|
145
|
-
private jwkToPem;
|
|
146
141
|
/** @internal Exposed for testing — clears JWKS cache */
|
|
147
142
|
clearCache(): void;
|
|
148
143
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as IQAuthClient } from './client-
|
|
1
|
+
import { I as IQAuthClient } from './client-vdh2a9fJ.mjs';
|
|
2
2
|
import { J as JwtClaims, N as ExpressMiddlewareOptions, Q as IQAuthRequestLike, R as IQAuthResponseLike, V as IQAuthNextFunction } from './types-Cxl3bQHt.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as IQAuthClient } from './client-
|
|
1
|
+
import { I as IQAuthClient } from './client-DTX4hNdS.js';
|
|
2
2
|
import { J as JwtClaims, N as ExpressMiddlewareOptions, Q as IQAuthRequestLike, R as IQAuthResponseLike, V as IQAuthNextFunction } from './types-Cxl3bQHt.js';
|
|
3
3
|
|
|
4
4
|
/**
|
package/dist/express.d.mts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { I as IQAuthClient } from './client-
|
|
2
|
-
import { C as CookieAwareMiddlewareOptions } from './express-
|
|
3
|
-
export { i as iqAuthMiddleware } from './express-
|
|
1
|
+
import { I as IQAuthClient } from './client-vdh2a9fJ.mjs';
|
|
2
|
+
import { C as CookieAwareMiddlewareOptions } from './express-A0-dWEMy.mjs';
|
|
3
|
+
export { i as iqAuthMiddleware } from './express-A0-dWEMy.mjs';
|
|
4
4
|
import { IQAuthHelperConfig } from './server/handlers.mjs';
|
|
5
5
|
import { Q as IQAuthRequestLike, R as IQAuthResponseLike, V as IQAuthNextFunction } from './types-Cxl3bQHt.mjs';
|
|
6
6
|
export { E as ErrorCodes, I as IQAuthError } from './errors-CDdl24MP.mjs';
|
|
7
|
-
import 'jsonwebtoken';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* @iqauth/sdk/express — drop-in Express adapter.
|
|
@@ -22,18 +21,89 @@ import 'jsonwebtoken';
|
|
|
22
21
|
* app.use(iqAuth({ publishableKey: process.env.IQAUTH_PUBLISHABLE_KEY!, secretKey: process.env.IQAUTH_SECRET_KEY! }));
|
|
23
22
|
*/
|
|
24
23
|
|
|
24
|
+
interface InlineCallbackBrandedRenderArgs {
|
|
25
|
+
/** Issuer URL the SDK will use to mint the authorization code (publishable key origin). */
|
|
26
|
+
issuer: string;
|
|
27
|
+
/** Path of the JSON exchange endpoint to POST to (e.g. `/api/iqauth/callback/exchange`). */
|
|
28
|
+
exchangePath: string;
|
|
29
|
+
/** The raw `?code=` value from the OAuth redirect (already escaped for HTML). */
|
|
30
|
+
code: string;
|
|
31
|
+
/** The raw `?state=` value from the OAuth redirect (already escaped for HTML). */
|
|
32
|
+
state: string;
|
|
33
|
+
/** If `errorPath` is configured on the inline-callback options, it's threaded
|
|
34
|
+
* here so a custom render function can reuse it for its own catch handler.
|
|
35
|
+
* `""` when unset. */
|
|
36
|
+
errorPath?: string;
|
|
37
|
+
}
|
|
38
|
+
interface InlineCallbackBrandedConfig {
|
|
39
|
+
/**
|
|
40
|
+
* Optional override for the spinner page HTML. Receives the issuer URL, the
|
|
41
|
+
* exchange endpoint path, and the (HTML-escaped) `code` + `state` from the
|
|
42
|
+
* OAuth redirect. Returns a full HTML document. When omitted, a minimal
|
|
43
|
+
* neutral spinner is rendered.
|
|
44
|
+
*/
|
|
45
|
+
render?: (args: InlineCallbackBrandedRenderArgs) => string;
|
|
46
|
+
}
|
|
47
|
+
interface InlineCallbackConfig {
|
|
48
|
+
/**
|
|
49
|
+
* When truthy, mount a GET-method handler on the same path as the POST
|
|
50
|
+
* callback so the OAuth redirect lands on a server-rendered page (no
|
|
51
|
+
* blank-tab while waiting for client JS). When `false`, only `POST` is
|
|
52
|
+
* mounted (the browser SDK posts the code + verifier itself).
|
|
53
|
+
*
|
|
54
|
+
* - `inlineCallback: true` — GET exchanges the code synchronously
|
|
55
|
+
* (PKCE verifier read from the `iqauth_pkce` first-party cookie set by
|
|
56
|
+
* the browser SDK before redirect) and 302s to the final URL.
|
|
57
|
+
*
|
|
58
|
+
* - `inlineCallback: { branded: true }` — GET returns a small spinner HTML
|
|
59
|
+
* document; the exchange happens via a sibling JSON endpoint at
|
|
60
|
+
* `${callbackPath}/exchange`.
|
|
61
|
+
*
|
|
62
|
+
* - `inlineCallback: { branded: { render } }` — same as above but lets
|
|
63
|
+
* you supply your own HTML (logo, copy, theme).
|
|
64
|
+
*/
|
|
65
|
+
branded?: boolean | InlineCallbackBrandedConfig;
|
|
66
|
+
/**
|
|
67
|
+
* Where to redirect on a failed inline callback (state mismatch, missing
|
|
68
|
+
* code, code-exchange error from the issuer, etc). When omitted, the
|
|
69
|
+
* plain inline flow returns a JSON error body and the branded flow
|
|
70
|
+
* surfaces the failure via the spinner script's catch handler. When set,
|
|
71
|
+
* the GET handler 302s to this path with `?error=<code>` appended.
|
|
72
|
+
*/
|
|
73
|
+
errorPath?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Cookie name the browser SDK uses to publish the OAuth `state` value
|
|
76
|
+
* before redirect. Validated against the `?state=` query param on the
|
|
77
|
+
* return trip. Defaults to `iqauth_state`.
|
|
78
|
+
*/
|
|
79
|
+
stateCookieName?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Cookie name the browser SDK uses to publish the post-login destination
|
|
82
|
+
* before redirect. The inline GET handler reads it and 302s the user
|
|
83
|
+
* there after a successful exchange. Defaults to `iqauth_return_to`.
|
|
84
|
+
*/
|
|
85
|
+
returnToCookieName?: string;
|
|
86
|
+
}
|
|
25
87
|
interface IQAuthExpressOptions extends IQAuthHelperConfig, CookieAwareMiddlewareOptions {
|
|
26
88
|
/** Mount path prefix for the auto-mounted helper routes. */
|
|
27
89
|
mountPath?: string;
|
|
28
90
|
/** Set to false to skip mounting helper routes (verify-only mode). */
|
|
29
91
|
mountHelperRoutes?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Mount a GET handler on the callback path so the OAuth redirect lands
|
|
94
|
+
* on a server-rendered page. Off by default (browser SDK posts the code
|
|
95
|
+
* itself). See {@link InlineCallbackConfig}.
|
|
96
|
+
*/
|
|
97
|
+
inlineCallback?: boolean | InlineCallbackConfig;
|
|
30
98
|
}
|
|
31
99
|
interface ExpressLikeApp {
|
|
32
100
|
post(path: string, handler: (req: any, res: any) => unknown | Promise<unknown>): unknown;
|
|
101
|
+
get?(path: string, handler: (req: any, res: any) => unknown | Promise<unknown>): unknown;
|
|
33
102
|
use?: (...args: unknown[]) => unknown;
|
|
34
103
|
}
|
|
35
104
|
interface ExpressLikeRouter {
|
|
36
105
|
post(path: string, handler: (req: any, res: any) => unknown | Promise<unknown>): unknown;
|
|
106
|
+
get?(path: string, handler: (req: any, res: any) => unknown | Promise<unknown>): unknown;
|
|
37
107
|
}
|
|
38
108
|
declare function iqAuth(options: IQAuthExpressOptions): {
|
|
39
109
|
(req: IQAuthRequestLike, res: IQAuthResponseLike, next: IQAuthNextFunction): unknown;
|
|
@@ -42,4 +112,4 @@ declare function iqAuth(options: IQAuthExpressOptions): {
|
|
|
42
112
|
client: IQAuthClient;
|
|
43
113
|
};
|
|
44
114
|
|
|
45
|
-
export { CookieAwareMiddlewareOptions, type IQAuthExpressOptions, iqAuth };
|
|
115
|
+
export { CookieAwareMiddlewareOptions, type IQAuthExpressOptions, type InlineCallbackBrandedConfig, type InlineCallbackBrandedRenderArgs, type InlineCallbackConfig, iqAuth };
|
package/dist/express.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { I as IQAuthClient } from './client-
|
|
2
|
-
import { C as CookieAwareMiddlewareOptions } from './express-
|
|
3
|
-
export { i as iqAuthMiddleware } from './express-
|
|
1
|
+
import { I as IQAuthClient } from './client-DTX4hNdS.js';
|
|
2
|
+
import { C as CookieAwareMiddlewareOptions } from './express-Bo_pJKHN.js';
|
|
3
|
+
export { i as iqAuthMiddleware } from './express-Bo_pJKHN.js';
|
|
4
4
|
import { IQAuthHelperConfig } from './server/handlers.js';
|
|
5
5
|
import { Q as IQAuthRequestLike, R as IQAuthResponseLike, V as IQAuthNextFunction } from './types-Cxl3bQHt.js';
|
|
6
6
|
export { E as ErrorCodes, I as IQAuthError } from './errors-CDdl24MP.js';
|
|
7
|
-
import 'jsonwebtoken';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* @iqauth/sdk/express — drop-in Express adapter.
|
|
@@ -22,18 +21,89 @@ import 'jsonwebtoken';
|
|
|
22
21
|
* app.use(iqAuth({ publishableKey: process.env.IQAUTH_PUBLISHABLE_KEY!, secretKey: process.env.IQAUTH_SECRET_KEY! }));
|
|
23
22
|
*/
|
|
24
23
|
|
|
24
|
+
interface InlineCallbackBrandedRenderArgs {
|
|
25
|
+
/** Issuer URL the SDK will use to mint the authorization code (publishable key origin). */
|
|
26
|
+
issuer: string;
|
|
27
|
+
/** Path of the JSON exchange endpoint to POST to (e.g. `/api/iqauth/callback/exchange`). */
|
|
28
|
+
exchangePath: string;
|
|
29
|
+
/** The raw `?code=` value from the OAuth redirect (already escaped for HTML). */
|
|
30
|
+
code: string;
|
|
31
|
+
/** The raw `?state=` value from the OAuth redirect (already escaped for HTML). */
|
|
32
|
+
state: string;
|
|
33
|
+
/** If `errorPath` is configured on the inline-callback options, it's threaded
|
|
34
|
+
* here so a custom render function can reuse it for its own catch handler.
|
|
35
|
+
* `""` when unset. */
|
|
36
|
+
errorPath?: string;
|
|
37
|
+
}
|
|
38
|
+
interface InlineCallbackBrandedConfig {
|
|
39
|
+
/**
|
|
40
|
+
* Optional override for the spinner page HTML. Receives the issuer URL, the
|
|
41
|
+
* exchange endpoint path, and the (HTML-escaped) `code` + `state` from the
|
|
42
|
+
* OAuth redirect. Returns a full HTML document. When omitted, a minimal
|
|
43
|
+
* neutral spinner is rendered.
|
|
44
|
+
*/
|
|
45
|
+
render?: (args: InlineCallbackBrandedRenderArgs) => string;
|
|
46
|
+
}
|
|
47
|
+
interface InlineCallbackConfig {
|
|
48
|
+
/**
|
|
49
|
+
* When truthy, mount a GET-method handler on the same path as the POST
|
|
50
|
+
* callback so the OAuth redirect lands on a server-rendered page (no
|
|
51
|
+
* blank-tab while waiting for client JS). When `false`, only `POST` is
|
|
52
|
+
* mounted (the browser SDK posts the code + verifier itself).
|
|
53
|
+
*
|
|
54
|
+
* - `inlineCallback: true` — GET exchanges the code synchronously
|
|
55
|
+
* (PKCE verifier read from the `iqauth_pkce` first-party cookie set by
|
|
56
|
+
* the browser SDK before redirect) and 302s to the final URL.
|
|
57
|
+
*
|
|
58
|
+
* - `inlineCallback: { branded: true }` — GET returns a small spinner HTML
|
|
59
|
+
* document; the exchange happens via a sibling JSON endpoint at
|
|
60
|
+
* `${callbackPath}/exchange`.
|
|
61
|
+
*
|
|
62
|
+
* - `inlineCallback: { branded: { render } }` — same as above but lets
|
|
63
|
+
* you supply your own HTML (logo, copy, theme).
|
|
64
|
+
*/
|
|
65
|
+
branded?: boolean | InlineCallbackBrandedConfig;
|
|
66
|
+
/**
|
|
67
|
+
* Where to redirect on a failed inline callback (state mismatch, missing
|
|
68
|
+
* code, code-exchange error from the issuer, etc). When omitted, the
|
|
69
|
+
* plain inline flow returns a JSON error body and the branded flow
|
|
70
|
+
* surfaces the failure via the spinner script's catch handler. When set,
|
|
71
|
+
* the GET handler 302s to this path with `?error=<code>` appended.
|
|
72
|
+
*/
|
|
73
|
+
errorPath?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Cookie name the browser SDK uses to publish the OAuth `state` value
|
|
76
|
+
* before redirect. Validated against the `?state=` query param on the
|
|
77
|
+
* return trip. Defaults to `iqauth_state`.
|
|
78
|
+
*/
|
|
79
|
+
stateCookieName?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Cookie name the browser SDK uses to publish the post-login destination
|
|
82
|
+
* before redirect. The inline GET handler reads it and 302s the user
|
|
83
|
+
* there after a successful exchange. Defaults to `iqauth_return_to`.
|
|
84
|
+
*/
|
|
85
|
+
returnToCookieName?: string;
|
|
86
|
+
}
|
|
25
87
|
interface IQAuthExpressOptions extends IQAuthHelperConfig, CookieAwareMiddlewareOptions {
|
|
26
88
|
/** Mount path prefix for the auto-mounted helper routes. */
|
|
27
89
|
mountPath?: string;
|
|
28
90
|
/** Set to false to skip mounting helper routes (verify-only mode). */
|
|
29
91
|
mountHelperRoutes?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Mount a GET handler on the callback path so the OAuth redirect lands
|
|
94
|
+
* on a server-rendered page. Off by default (browser SDK posts the code
|
|
95
|
+
* itself). See {@link InlineCallbackConfig}.
|
|
96
|
+
*/
|
|
97
|
+
inlineCallback?: boolean | InlineCallbackConfig;
|
|
30
98
|
}
|
|
31
99
|
interface ExpressLikeApp {
|
|
32
100
|
post(path: string, handler: (req: any, res: any) => unknown | Promise<unknown>): unknown;
|
|
101
|
+
get?(path: string, handler: (req: any, res: any) => unknown | Promise<unknown>): unknown;
|
|
33
102
|
use?: (...args: unknown[]) => unknown;
|
|
34
103
|
}
|
|
35
104
|
interface ExpressLikeRouter {
|
|
36
105
|
post(path: string, handler: (req: any, res: any) => unknown | Promise<unknown>): unknown;
|
|
106
|
+
get?(path: string, handler: (req: any, res: any) => unknown | Promise<unknown>): unknown;
|
|
37
107
|
}
|
|
38
108
|
declare function iqAuth(options: IQAuthExpressOptions): {
|
|
39
109
|
(req: IQAuthRequestLike, res: IQAuthResponseLike, next: IQAuthNextFunction): unknown;
|
|
@@ -42,4 +112,4 @@ declare function iqAuth(options: IQAuthExpressOptions): {
|
|
|
42
112
|
client: IQAuthClient;
|
|
43
113
|
};
|
|
44
114
|
|
|
45
|
-
export { CookieAwareMiddlewareOptions, type IQAuthExpressOptions, iqAuth };
|
|
115
|
+
export { CookieAwareMiddlewareOptions, type IQAuthExpressOptions, type InlineCallbackBrandedConfig, type InlineCallbackBrandedRenderArgs, type InlineCallbackConfig, iqAuth };
|