@imtbl/auth-nextjs 2.12.4-alpha.4 → 2.12.4-alpha.6

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.
@@ -19,18 +19,23 @@ export interface CallbackPageProps {
19
19
  errorComponent?: (error: string) => React.ReactElement | null;
20
20
  }
21
21
  /**
22
- * Callback page component for handling OAuth redirects.
22
+ * Callback page component for handling OAuth redirects (App Router version).
23
23
  *
24
24
  * Use this in your callback page to process authentication responses.
25
25
  *
26
26
  * @example
27
27
  * ```tsx
28
- * // pages/callback.tsx
28
+ * // app/callback/page.tsx
29
+ * "use client";
29
30
  * import { CallbackPage } from "@imtbl/auth-nextjs/client";
30
- * import { immutableConfig } from "@/lib/auth-nextjs";
31
+ *
32
+ * const config = {
33
+ * clientId: process.env.NEXT_PUBLIC_IMMUTABLE_CLIENT_ID!,
34
+ * redirectUri: `${process.env.NEXT_PUBLIC_BASE_URL}/callback`,
35
+ * };
31
36
  *
32
37
  * export default function Callback() {
33
- * return <CallbackPage config={immutableConfig} />;
38
+ * return <CallbackPage config={config} />;
34
39
  * }
35
40
  * ```
36
41
  */
@@ -1,3 +1,5 @@
1
1
  export { ImmutableAuthProvider, useImmutableAuth, useAccessToken, } from './provider';
2
2
  export { CallbackPage, type CallbackPageProps } from './callback';
3
3
  export type { ImmutableAuthProviderProps, UseImmutableAuthReturn, ImmutableAuthConfig, ImmutableUser, } from '../types';
4
+ export type { LoginOptions, DirectLoginOptions } from '@imtbl/auth';
5
+ export { MarketingConsentStatus } from '@imtbl/auth';
@@ -1,12 +1,13 @@
1
1
  import type { ImmutableAuthProviderProps, UseImmutableAuthReturn } from '../types';
2
2
  /**
3
- * Provider component for Immutable authentication with NextAuth
3
+ * Provider component for Immutable authentication with Auth.js v5
4
4
  *
5
5
  * Wraps your app to provide authentication state via useImmutableAuth hook.
6
6
  *
7
- * @example
7
+ * @example App Router (recommended)
8
8
  * ```tsx
9
- * // pages/_app.tsx
9
+ * // app/providers.tsx
10
+ * "use client";
10
11
  * import { ImmutableAuthProvider } from "@imtbl/auth-nextjs/client";
11
12
  *
12
13
  * const config = {
@@ -14,13 +15,26 @@ import type { ImmutableAuthProviderProps, UseImmutableAuthReturn } from '../type
14
15
  * redirectUri: `${process.env.NEXT_PUBLIC_BASE_URL}/callback`,
15
16
  * };
16
17
  *
17
- * export default function App({ Component, pageProps }: AppProps) {
18
+ * export function Providers({ children }: { children: React.ReactNode }) {
18
19
  * return (
19
- * <ImmutableAuthProvider config={config} session={pageProps.session}>
20
- * <Component {...pageProps} />
20
+ * <ImmutableAuthProvider config={config}>
21
+ * {children}
21
22
  * </ImmutableAuthProvider>
22
23
  * );
23
24
  * }
25
+ *
26
+ * // app/layout.tsx
27
+ * import { Providers } from "./providers";
28
+ *
29
+ * export default function RootLayout({ children }: { children: React.ReactNode }) {
30
+ * return (
31
+ * <html>
32
+ * <body>
33
+ * <Providers>{children}</Providers>
34
+ * </body>
35
+ * </html>
36
+ * );
37
+ * }
24
38
  * ```
25
39
  */
26
40
  export declare function ImmutableAuthProvider({ children, config, session, basePath, }: ImmutableAuthProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -1,23 +1,21 @@
1
- import type { NextAuthOptions } from 'next-auth';
1
+ import type { NextAuthConfig } from 'next-auth';
2
2
  import type { ImmutableAuthConfig } from './types';
3
3
  /**
4
- * Create NextAuth options configured for Immutable authentication
4
+ * Create Auth.js v5 configuration for Immutable authentication
5
5
  *
6
6
  * @example
7
7
  * ```typescript
8
8
  * // lib/auth.ts
9
- * import { createAuthOptions } from "@imtbl/auth-nextjs";
9
+ * import NextAuth from "next-auth";
10
+ * import { createAuthConfig } from "@imtbl/auth-nextjs";
10
11
  *
11
- * export const authOptions = createAuthOptions({
12
+ * const config = {
12
13
  * clientId: process.env.NEXT_PUBLIC_IMMUTABLE_CLIENT_ID!,
13
14
  * redirectUri: `${process.env.NEXT_PUBLIC_BASE_URL}/callback`,
14
- * });
15
- *
16
- * // pages/api/auth/[...nextauth].ts
17
- * import NextAuth from "next-auth";
18
- * import { authOptions } from "@/lib/auth";
15
+ * };
19
16
  *
20
- * export default NextAuth(authOptions);
17
+ * export const { handlers, auth, signIn, signOut } = NextAuth(createAuthConfig(config));
21
18
  * ```
22
19
  */
23
- export declare function createAuthOptions(config: ImmutableAuthConfig): NextAuthOptions;
20
+ export declare function createAuthConfig(config: ImmutableAuthConfig): NextAuthConfig;
21
+ export declare const createAuthOptions: typeof createAuthConfig;
@@ -1,15 +1,22 @@
1
- import { type NextAuthOptions } from 'next-auth';
1
+ import NextAuthImport from 'next-auth';
2
+ import type { NextAuthConfig } from 'next-auth';
2
3
  import type { ImmutableAuthConfig } from './types';
4
+ declare const NextAuth: typeof NextAuthImport;
3
5
  /**
4
- * NextAuth options that can be overridden.
6
+ * Auth.js v5 config options that can be overridden.
5
7
  * Excludes 'providers' as that's managed internally.
6
8
  */
7
- export type ImmutableAuthOverrides = Omit<NextAuthOptions, 'providers'>;
9
+ export type ImmutableAuthOverrides = Omit<NextAuthConfig, 'providers'>;
8
10
  /**
9
- * Create a NextAuth handler with Immutable authentication
11
+ * Return type of createImmutableAuth - the NextAuth instance with handlers
12
+ */
13
+ export type ImmutableAuthResult = ReturnType<typeof NextAuth>;
14
+ /**
15
+ * Create an Auth.js v5 instance with Immutable authentication
10
16
  *
11
17
  * @param config - Immutable auth configuration
12
- * @param overrides - Optional NextAuth options to override defaults
18
+ * @param overrides - Optional Auth.js options to override defaults
19
+ * @returns NextAuth instance with { handlers, auth, signIn, signOut }
13
20
  *
14
21
  * @remarks
15
22
  * Callback composition: The `jwt` and `session` callbacks are composed rather than
@@ -17,20 +24,24 @@ export type ImmutableAuthOverrides = Omit<NextAuthOptions, 'providers'>;
17
24
  * your custom callbacks receive the result. Other callbacks (`signIn`, `redirect`)
18
25
  * are replaced entirely if provided.
19
26
  *
20
- * @example Basic usage
27
+ * @example Basic usage (App Router)
21
28
  * ```typescript
22
- * // pages/api/auth/[...nextauth].ts
23
- * import { ImmutableAuth } from "@imtbl/auth-nextjs";
29
+ * // lib/auth.ts
30
+ * import { createImmutableAuth } from "@imtbl/auth-nextjs";
24
31
  *
25
- * export default ImmutableAuth({
32
+ * export const { handlers, auth, signIn, signOut } = createImmutableAuth({
26
33
  * clientId: process.env.NEXT_PUBLIC_IMMUTABLE_CLIENT_ID!,
27
34
  * redirectUri: `${process.env.NEXT_PUBLIC_BASE_URL}/callback`,
28
35
  * });
36
+ *
37
+ * // app/api/auth/[...nextauth]/route.ts
38
+ * import { handlers } from "@/lib/auth";
39
+ * export const { GET, POST } = handlers;
29
40
  * ```
30
41
  *
31
- * @example With NextAuth overrides
42
+ * @example With Auth.js overrides
32
43
  * ```typescript
33
- * export default ImmutableAuth(
44
+ * export const { handlers, auth } = createImmutableAuth(
34
45
  * { clientId: "...", redirectUri: "..." },
35
46
  * {
36
47
  * pages: { signIn: "/custom-login", error: "/auth-error" },
@@ -41,7 +52,7 @@ export type ImmutableAuthOverrides = Omit<NextAuthOptions, 'providers'>;
41
52
  *
42
53
  * @example With custom jwt callback (composed with internal callback)
43
54
  * ```typescript
44
- * export default ImmutableAuth(
55
+ * export const { handlers, auth } = createImmutableAuth(
45
56
  * { clientId: "...", redirectUri: "..." },
46
57
  * {
47
58
  * callbacks: {
@@ -56,6 +67,11 @@ export type ImmutableAuthOverrides = Omit<NextAuthOptions, 'providers'>;
56
67
  * );
57
68
  * ```
58
69
  */
59
- export declare function ImmutableAuth(config: ImmutableAuthConfig, overrides?: ImmutableAuthOverrides): any;
60
- export type { ImmutableAuthConfig, ImmutableTokenData, ImmutableUser, ZkEvmInfo, WithPageAuthRequiredOptions, } from './types';
70
+ export declare function createImmutableAuth(config: ImmutableAuthConfig, overrides?: ImmutableAuthOverrides): ImmutableAuthResult;
71
+ export declare const ImmutableAuth: typeof createImmutableAuth;
72
+ export { createAuthConfig } from './config';
73
+ export type { ImmutableAuthConfig, ImmutableTokenData, ImmutableUser, ZkEvmInfo, } from './types';
74
+ export type { LoginOptions, DirectLoginOptions } from '@imtbl/auth';
75
+ export { MarketingConsentStatus } from '@imtbl/auth';
61
76
  export { refreshAccessToken, isTokenExpired } from './refresh';
77
+ export { DEFAULT_AUTH_DOMAIN, DEFAULT_AUDIENCE, DEFAULT_SCOPE, DEFAULT_NEXTAUTH_BASE_PATH, } from './constants';
@@ -2,7 +2,7 @@ import type { JWT } from 'next-auth/jwt';
2
2
  import type { ImmutableAuthConfig } from './types';
3
3
  /**
4
4
  * Refresh the access token using the refresh token
5
- * Called by NextAuth JWT callback when token is expired
5
+ * Called by Auth.js JWT callback when token is expired
6
6
  */
7
7
  export declare function refreshAccessToken(token: JWT, config: ImmutableAuthConfig): Promise<JWT>;
8
8
  /**
@@ -1,2 +1,104 @@
1
- export { withPageAuthRequired, getImmutableSession, type WithPageAuthRequiredFullOptions, type WithPageAuthRequiredProps, } from './with-page-auth';
2
- export type { WithPageAuthRequiredOptions } from '../types';
1
+ import { type NextRequest, NextResponse } from 'next/server';
2
+ import type { Session } from 'next-auth';
3
+ export { createImmutableAuth, createAuthConfig } from '../index';
4
+ /**
5
+ * Options for createAuthMiddleware
6
+ */
7
+ export interface AuthMiddlewareOptions {
8
+ /**
9
+ * URL to redirect to when not authenticated
10
+ * @default "/login"
11
+ */
12
+ loginUrl?: string;
13
+ /**
14
+ * Paths that should be protected (regex patterns)
15
+ * If not provided, middleware should be configured via Next.js matcher
16
+ */
17
+ protectedPaths?: (string | RegExp)[];
18
+ /**
19
+ * Paths that should be excluded from protection (regex patterns)
20
+ * Takes precedence over protectedPaths
21
+ */
22
+ publicPaths?: (string | RegExp)[];
23
+ }
24
+ /**
25
+ * Type for the auth function returned by createImmutableAuth
26
+ */
27
+ export type AuthFunction = () => Promise<Session | null>;
28
+ /**
29
+ * Create a Next.js middleware for protecting routes with Immutable authentication.
30
+ *
31
+ * This is the App Router replacement for `withPageAuthRequired`.
32
+ *
33
+ * @param auth - The auth function from createImmutableAuth
34
+ * @param options - Middleware options
35
+ * @returns A Next.js middleware function
36
+ *
37
+ * @example Basic usage with Next.js middleware:
38
+ * ```typescript
39
+ * // middleware.ts
40
+ * import { createAuthMiddleware } from "@imtbl/auth-nextjs/server";
41
+ * import { auth } from "@/lib/auth";
42
+ *
43
+ * export default createAuthMiddleware(auth, {
44
+ * loginUrl: "/login",
45
+ * });
46
+ *
47
+ * export const config = {
48
+ * matcher: ["/dashboard/:path*", "/profile/:path*"],
49
+ * };
50
+ * ```
51
+ *
52
+ * @example With path configuration:
53
+ * ```typescript
54
+ * export default createAuthMiddleware(auth, {
55
+ * loginUrl: "/login",
56
+ * protectedPaths: [/^\/dashboard/, /^\/profile/],
57
+ * publicPaths: [/^\/api\/public/],
58
+ * });
59
+ * ```
60
+ */
61
+ export declare function createAuthMiddleware(auth: AuthFunction, options?: AuthMiddlewareOptions): (request: NextRequest) => Promise<NextResponse<unknown>>;
62
+ /**
63
+ * Higher-order function to protect a Server Action or Route Handler.
64
+ *
65
+ * The returned function forwards all arguments from Next.js to your handler,
66
+ * allowing access to the request, context, form data, or any other arguments.
67
+ *
68
+ * @param auth - The auth function from createImmutableAuth
69
+ * @param handler - The handler function to protect. Receives session as first arg,
70
+ * followed by any arguments passed by Next.js (request, context, etc.)
71
+ * @returns A protected handler that checks authentication before executing
72
+ *
73
+ * @example Protecting a Route Handler with request access:
74
+ * ```typescript
75
+ * // app/api/protected/route.ts
76
+ * import { withAuth } from "@imtbl/auth-nextjs/server";
77
+ * import { auth } from "@/lib/auth";
78
+ *
79
+ * export const POST = withAuth(auth, async (session, request: Request) => {
80
+ * const body = await request.json();
81
+ * return Response.json({ user: session.user, data: body });
82
+ * });
83
+ *
84
+ * export const GET = withAuth(auth, async (session, request: Request, context) => {
85
+ * const { params } = context;
86
+ * return Response.json({ user: session.user, params: await params });
87
+ * });
88
+ * ```
89
+ *
90
+ * @example Protecting a Server Action:
91
+ * ```typescript
92
+ * // app/actions.ts
93
+ * "use server";
94
+ * import { withAuth } from "@imtbl/auth-nextjs/server";
95
+ * import { auth } from "@/lib/auth";
96
+ *
97
+ * export const protectedAction = withAuth(auth, async (session, formData: FormData) => {
98
+ * const userId = session.user.sub;
99
+ * const name = formData.get("name");
100
+ * // ... your action logic
101
+ * });
102
+ * ```
103
+ */
104
+ export declare function withAuth<TArgs extends unknown[], TReturn>(auth: AuthFunction, handler: (session: Session, ...args: TArgs) => Promise<TReturn>): (...args: TArgs) => Promise<TReturn>;
@@ -1,7 +1,7 @@
1
- import type { DefaultSession, DefaultUser, Session } from 'next-auth';
2
- import type { DefaultJWT } from 'next-auth/jwt';
1
+ import type { DefaultSession, Session } from 'next-auth';
2
+ import type { JWT } from 'next-auth/jwt';
3
3
  /**
4
- * Configuration for ImmutableAuthProvider and createAuthOptions
4
+ * Configuration for ImmutableAuthProvider and createImmutableAuth
5
5
  */
6
6
  export interface ImmutableAuthConfig {
7
7
  /**
@@ -45,11 +45,11 @@ export interface ImmutableUser {
45
45
  nickname?: string;
46
46
  }
47
47
  /**
48
- * NextAuth module augmentation to add Immutable-specific fields
48
+ * Auth.js v5 module augmentation to add Immutable-specific fields
49
49
  */
50
50
  declare module 'next-auth' {
51
51
  interface Session extends DefaultSession {
52
- user: ImmutableUser;
52
+ user: ImmutableUser & DefaultSession['user'];
53
53
  accessToken: string;
54
54
  refreshToken?: string;
55
55
  idToken?: string;
@@ -57,9 +57,10 @@ declare module 'next-auth' {
57
57
  zkEvm?: ZkEvmInfo;
58
58
  error?: string;
59
59
  }
60
- interface User extends DefaultUser {
60
+ interface User {
61
+ id: string;
61
62
  sub: string;
62
- email?: string;
63
+ email?: string | null;
63
64
  nickname?: string;
64
65
  accessToken: string;
65
66
  refreshToken?: string;
@@ -69,20 +70,20 @@ declare module 'next-auth' {
69
70
  }
70
71
  }
71
72
  declare module 'next-auth/jwt' {
72
- interface JWT extends DefaultJWT {
73
- sub: string;
74
- email?: string;
73
+ interface JWT {
74
+ sub?: string;
75
+ email?: string | null;
75
76
  nickname?: string;
76
- accessToken: string;
77
+ accessToken?: string;
77
78
  refreshToken?: string;
78
79
  idToken?: string;
79
- accessTokenExpires: number;
80
+ accessTokenExpires?: number;
80
81
  zkEvm?: ZkEvmInfo;
81
82
  error?: string;
82
83
  }
83
84
  }
84
85
  /**
85
- * Token data passed from client to NextAuth credentials provider
86
+ * Token data passed from client to Auth.js credentials provider
86
87
  */
87
88
  export interface ImmutableTokenData {
88
89
  accessToken: string;
@@ -127,11 +128,11 @@ export interface ImmutableAuthProviderProps {
127
128
  config: ImmutableAuthConfig;
128
129
  /**
129
130
  * Initial session from server (for SSR hydration)
130
- * Can be Session from getServerSession or any compatible session object
131
+ * Can be Session from auth() or any compatible session object
131
132
  */
132
133
  session?: Session | DefaultSession | null;
133
134
  /**
134
- * Custom base path for NextAuth API routes
135
+ * Custom base path for Auth.js API routes
135
136
  * Use this when you have multiple auth endpoints (e.g., per environment)
136
137
  * @default "/api/auth"
137
138
  */
@@ -146,7 +147,7 @@ export interface UseImmutableAuthReturn {
146
147
  */
147
148
  user: ImmutableUser | null;
148
149
  /**
149
- * Full NextAuth session with tokens
150
+ * Full Auth.js session with tokens
150
151
  */
151
152
  session: Session | null;
152
153
  /**
@@ -159,10 +160,11 @@ export interface UseImmutableAuthReturn {
159
160
  isAuthenticated: boolean;
160
161
  /**
161
162
  * Sign in with Immutable (opens popup)
163
+ * @param options - Optional login options (cached session, silent login, redirect flow, direct login)
162
164
  */
163
- signIn: () => Promise<void>;
165
+ signIn: (options?: import('@imtbl/auth').LoginOptions) => Promise<void>;
164
166
  /**
165
- * Sign out from both NextAuth and Immutable
167
+ * Sign out from both Auth.js and Immutable
166
168
  */
167
169
  signOut: () => Promise<void>;
168
170
  /**
@@ -174,18 +176,4 @@ export interface UseImmutableAuthReturn {
174
176
  */
175
177
  auth: import('@imtbl/auth').Auth | null;
176
178
  }
177
- /**
178
- * Options for withPageAuthRequired
179
- */
180
- export interface WithPageAuthRequiredOptions {
181
- /**
182
- * URL to redirect to when not authenticated
183
- * @default "/login"
184
- */
185
- loginUrl?: string;
186
- /**
187
- * URL to redirect to after login
188
- * @default current page
189
- */
190
- returnTo?: string | false;
191
- }
179
+ export type { JWT };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imtbl/auth-nextjs",
3
- "version": "2.12.4-alpha.4",
4
- "description": "Next.js authentication integration for Immutable SDK using NextAuth",
3
+ "version": "2.12.4-alpha.6",
4
+ "description": "Next.js App Router authentication integration for Immutable SDK using Auth.js v5",
5
5
  "author": "Immutable",
6
6
  "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
7
7
  "homepage": "https://github.com/immutable/ts-immutable-sdk#readme",
@@ -51,11 +51,11 @@
51
51
  "dist"
52
52
  ],
53
53
  "dependencies": {
54
- "@imtbl/auth": "2.12.4-alpha.4"
54
+ "@imtbl/auth": "2.12.4-alpha.6"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "next": "14.2.25",
58
- "next-auth": "^4.24.0",
58
+ "next-auth": "^5.0.0-beta.30",
59
59
  "react": "^18.2.0"
60
60
  },
61
61
  "devDependencies": {
@@ -67,7 +67,7 @@
67
67
  "jest": "^29.4.3",
68
68
  "jest-environment-jsdom": "^29.4.3",
69
69
  "next": "14.2.25",
70
- "next-auth": "^4.24.0",
70
+ "next-auth": "^5.0.0-beta.30",
71
71
  "react": "^18.2.0",
72
72
  "ts-node": "^10.9.1",
73
73
  "tsup": "^8.3.0",
@@ -1,94 +0,0 @@
1
- import type { GetServerSideProps, GetServerSidePropsContext, GetServerSidePropsResult } from 'next';
2
- import type { IncomingMessage, ServerResponse } from 'http';
3
- import { type Session } from 'next-auth';
4
- import type { ImmutableAuthConfig, WithPageAuthRequiredOptions } from '../types';
5
- /**
6
- * Extended options for withPageAuthRequired
7
- */
8
- export interface WithPageAuthRequiredFullOptions<P extends Record<string, unknown> = Record<string, unknown>> extends WithPageAuthRequiredOptions {
9
- /**
10
- * Custom getServerSideProps that runs after auth check.
11
- * Session is guaranteed to exist when this runs.
12
- */
13
- getServerSideProps?: (ctx: GetServerSidePropsContext, session: Session) => Promise<GetServerSidePropsResult<P>>;
14
- }
15
- /**
16
- * Props added by withPageAuthRequired
17
- */
18
- export interface WithPageAuthRequiredProps {
19
- session: Session;
20
- }
21
- /**
22
- * Get the Immutable session on the server side.
23
- *
24
- * @example
25
- * ```typescript
26
- * // pages/api/user.ts
27
- * import { getImmutableSession } from "@imtbl/auth-nextjs/server";
28
- *
29
- * const config = { clientId: "...", redirectUri: "..." };
30
- *
31
- * export default async function handler(req, res) {
32
- * const session = await getImmutableSession(req, res, config);
33
- * if (!session) {
34
- * return res.status(401).json({ error: "Not authenticated" });
35
- * }
36
- * res.json({ user: session.user });
37
- * }
38
- * ```
39
- *
40
- * @example In getServerSideProps
41
- * ```typescript
42
- * export const getServerSideProps = async (ctx) => {
43
- * const session = await getImmutableSession(ctx.req, ctx.res, config);
44
- * return { props: { user: session?.user ?? null } };
45
- * };
46
- * ```
47
- */
48
- export declare function getImmutableSession(req: IncomingMessage & {
49
- cookies: Partial<Record<string, string>>;
50
- }, res: ServerResponse, config: ImmutableAuthConfig): Promise<Session | null>;
51
- /**
52
- * Higher-order function that protects a page with authentication.
53
- *
54
- * When a signed-out user visits the page:
55
- * 1. Server checks session via getServerSession() → returns null
56
- * 2. Returns HTTP redirect to login page with returnTo parameter
57
- * 3. After login, user is redirected back to original page
58
- *
59
- * @example Basic usage:
60
- * ```typescript
61
- * // pages/dashboard.tsx
62
- * import { withPageAuthRequired } from "@imtbl/auth-nextjs/server";
63
- *
64
- * const config = { clientId: "...", redirectUri: "..." };
65
- *
66
- * function DashboardPage() {
67
- * // Page only renders if user is authenticated
68
- * return <h1>Dashboard</h1>;
69
- * }
70
- *
71
- * export default DashboardPage;
72
- * export const getServerSideProps = withPageAuthRequired(config);
73
- * ```
74
- *
75
- * @example With additional data fetching:
76
- * ```typescript
77
- * export const getServerSideProps = withPageAuthRequired(config, {
78
- * async getServerSideProps(ctx, session) {
79
- * // session is guaranteed to exist here
80
- * const data = await fetchData(session.accessToken);
81
- * return { props: { data } };
82
- * },
83
- * });
84
- * ```
85
- *
86
- * @example With custom options:
87
- * ```typescript
88
- * export const getServerSideProps = withPageAuthRequired(config, {
89
- * loginUrl: "/auth/signin",
90
- * returnTo: "/dashboard",
91
- * });
92
- * ```
93
- */
94
- export declare function withPageAuthRequired<P extends Record<string, unknown> = Record<string, unknown>>(config: ImmutableAuthConfig, options?: WithPageAuthRequiredFullOptions<P>): GetServerSideProps<WithPageAuthRequiredProps & P>;