-
Notifications
You must be signed in to change notification settings - Fork 37
feat(auth-nextjs): add auth-nextjs package #2765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
packages/passport/sdk-sample-app/src/pages/api/auth/sandbox/[...nextauth].api.ts
Show resolved
Hide resolved
|
View your CI Pipeline Execution ↗ for commit 5b504b5
☁️ Nx Cloud last updated this comment at |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx affected -t build,lint,test |
❌ Failed | 3m 12s | View ↗ |
nx run-many -p @imtbl/sdk,@imtbl/checkout-widge... |
✅ Succeeded | 3s | View ↗ |
☁️ Nx Cloud last updated this comment at 2025-12-17 04:04:32 UTC
| // Default to DEV to match ImmutableProvider's default context environment | ||
| const storedEnv = localStorage.getItem("IMX_PASSPORT_SAMPLE_ENVIRONMENT"); | ||
| const environment = storedEnv | ||
| ? (JSON.parse(storedEnv) as EnvironmentNames) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Unhandled JSON.parse may crash callback page
The JSON.parse(storedEnv) call has no try-catch wrapper. If the localStorage value for IMX_PASSPORT_SAMPLE_ENVIRONMENT is corrupted or manually modified to contain invalid JSON, the callback page will throw an unhandled exception and crash, preventing the OAuth flow from completing.

Summary
Adding auth-nextjs for convenient integration with nextjs + SSR.
Note
Adds
@imtbl/auth-nextjs(NextAuth integration with SSR, hooks, token refresh), re-exports it from the SDK, and integrates it into the Passport sample app with env-specific API routes and provider setup.packages/auth-nextjsImmutableAuth,createAuthOptions) with token refresh, JWT/session callbacks, and server-side session validation.ImmutableAuthProvider,useImmutableAuth,useAccessToken,CallbackPage.getImmutableSession,withPageAuthRequired.@imtbl/auth-nextjsand re-exports viasdk(entries:auth_nextjs,auth_nextjs/client,auth_nextjs/server).sdk/srcto exposeauth,wallet, andauthNextjsnamespaces; extendsexportsmap.packages/passport/sdk-sample-app):@imtbl/auth-nextjs: wraps app withImmutableAuthProvider, addsAuthNextJSdemo component, and prevents env switching when authenticated./api/auth/{dev|sandbox|prod}/[...nextauth].api.ts) and callback page.next.config.jstoggles API routes viaENABLE_API_ROUTES, supports static export when disabled;package.jsonaddsnext-authand updatesdev-with-sdkscript.packages/auth-nextjstopnpm-workspace.yaml..npmrcnetwork-concurrency=1.NODE_OPTIONSto10240.Written by Cursor Bugbot for commit 5b504b5. This will update automatically on new commits. Configure here.