Skip to content

Commit 5d2f714

Browse files
fix(examples,auth-next): fix build issues and add missing config
- Fix Next.js version compatibility: downgrade auth-next packages to support Next 14+ - Add ESLint config for auth-next-default-test example - Fix ESLint errors: escape quotes in JSX strings - Fix CallbackPage props: add required config parameter with auto-detection - Add type cast to resolve NextAuth config type conflicts - Update pnpm-lock.yaml Changes: - auth-next-client/server: Next peerDependency now ^14.0.0 || ^15.0.0 - auth-next-client/server: devDependency downgraded to 14.2.25 - auth-next-default-test: add .eslintrc.json - auth-next-default-test: fix JSX quote escaping - auth-next-default-test: add auto-detected config to CallbackPage - auth-next-default-test: add type cast to NextAuth call These changes ensure the example app builds successfully in CI. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 94e99ba commit 5d2f714

12 files changed

Lines changed: 571 additions & 87 deletions

File tree

TEST_PLAN_DEFAULT_AUTH.md

Lines changed: 469 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"root": true,
3+
"extends": ["next/core-web-vitals", "next"]
4+
}
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11
"use client";
22

33
import { CallbackPage } from "@imtbl/auth-next-client";
4+
import {
5+
DEFAULT_PRODUCTION_CLIENT_ID,
6+
DEFAULT_SANDBOX_CLIENT_ID,
7+
} from "@imtbl/auth-next-client";
48

59
export default function Callback() {
10+
// Auto-detect environment and derive config
11+
const isSandbox = typeof window !== 'undefined' &&
12+
(window.location.hostname.includes('sandbox') || window.location.hostname.includes('localhost'));
13+
14+
const config = {
15+
clientId: isSandbox ? DEFAULT_SANDBOX_CLIENT_ID : DEFAULT_PRODUCTION_CLIENT_ID,
16+
redirectUri: typeof window !== 'undefined' ? `${window.location.origin}/callback` : '/callback',
17+
};
18+
619
return (
720
<div>
821
<h1>Processing authentication...</h1>
9-
<CallbackPage redirectTo="/" />
22+
<CallbackPage config={config} redirectTo="/" />
1023
</div>
1124
);
1225
}
26+

examples/passport/auth-next-default-test/app/components/ConfigInfo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export function ConfigInfo() {
4141
<li><strong>ClientId:</strong> <span className="code">{info.expectedClientId}</span></li>
4242
<li><strong>RedirectUri:</strong> <span className="code">{info.redirectUri}</span></li>
4343
</ul>
44-
<p><small>These values are automatically detected and don't need to be configured!</small></p>
44+
<p><small>These values are automatically detected and don&apos;t need to be configured!</small></p>
4545
</div>
4646
);
4747
}

examples/passport/auth-next-default-test/app/components/LoginWithOverride.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function LoginWithOverride() {
4949
</button>
5050
{error && <p className="error">Error: {error}</p>}
5151
<p className="info">
52-
This tests <span className="code">loginWithPopup(&#123; clientId: '...' &#125;)</span><br/>
52+
This tests <span className="code">loginWithPopup(&#123; clientId: &apos;...&apos; &#125;)</span><br/>
5353
Custom clientId overrides the default, but redirectUri is still auto-detected.
5454
</p>
5555
</div>

examples/passport/auth-next-default-test/app/components/LogoutWithOverride.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function LogoutWithOverride() {
4444
</button>
4545
{error && <p className="error">Error: {error}</p>}
4646
<p className="info">
47-
This tests <span className="code">logout(&#123; logoutRedirectUri: '...' &#125;)</span><br/>
47+
This tests <span className="code">logout(&#123; logoutRedirectUri: &apos;...&apos; &#125;)</span><br/>
4848
Custom redirect after logout, but clientId is still auto-detected.
4949
</p>
5050
</div>

examples/passport/auth-next-default-test/lib/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ import { createDefaultAuthConfig } from "@imtbl/auth-next-server";
88
* - redirectUri: auto-derived from window.location.origin + '/callback'
99
* - audience, scope, authenticationDomain: use sensible defaults
1010
*/
11-
export const { handlers, auth, signIn, signOut } = NextAuth(createDefaultAuthConfig());
11+
export const { handlers, auth, signIn, signOut } = NextAuth(createDefaultAuthConfig() as any);
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3-
/// <reference path="./.next/types/routes.d.ts" />
43

54
// NOTE: This file should not be edited
6-
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
5+
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.

examples/passport/auth-next-default-test/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"dependencies": {
1212
"@imtbl/auth-next-client": "workspace:*",
1313
"@imtbl/auth-next-server": "workspace:*",
14-
"next": "^15.1.6",
14+
"next": "14.2.25",
1515
"next-auth": "^5.0.0-beta.30",
1616
"react": "^18.2.0",
1717
"react-dom": "^18.2.0"

packages/auth-next-client/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"@imtbl/auth-next-server": "workspace:*"
4141
},
4242
"peerDependencies": {
43-
"next": "^15.0.0",
43+
"next": "^14.0.0 || ^15.0.0",
4444
"next-auth": "^5.0.0-beta.25",
4545
"react": "^18.2.0 || ^19.0.0"
4646
},
@@ -65,7 +65,7 @@
6565
"@types/react": "^18.3.5",
6666
"eslint": "^8.56.0",
6767
"jest": "^29.7.0",
68-
"next": "^15.1.6",
68+
"next": "14.2.25",
6969
"next-auth": "^5.0.0-beta.30",
7070
"react": "^18.2.0",
7171
"tsup": "^8.3.0",

0 commit comments

Comments
 (0)