Skip to content

feat(passport): nextjs packages#2768

Merged
shineli1984 merged 132 commits intomainfrom
auth-next
Feb 5, 2026
Merged

feat(passport): nextjs packages#2768
shineli1984 merged 132 commits intomainfrom
auth-next

Conversation

@shineli1984
Copy link
Collaborator

@shineli1984 shineli1984 commented Jan 16, 2026

Summary

Created packages that work with nextjs.

auth-next-client/server packages are introduced to make it easier to work with next-auth.js. Sessions and jwt (including refresh) are handled purely server side.
Wallet package has been updated to work this setup and is also compatible with auth and passport packages.

@shineli1984 shineli1984 requested a review from a team as a code owner January 22, 2026 22:56
Merged origin/main into auth-next branch, resolving conflicts in:
- ZkEvmWorkflow.tsx: Kept auth-next config with ZkEvmProvider type
- PassportProvider.tsx: Kept improved error handling from auth-next
- index.page.tsx: Merged AuthNextJS and ArbitrumWorkflow features
- wallet/package.json: Added sequence deps from main with newer @swc/core
@shineli1984 shineli1984 merged commit 1a3263d into main Feb 5, 2026
10 of 11 checks passed
@shineli1984 shineli1984 deleted the auth-next branch February 5, 2026 22:50
rodrigo-fournier-immutable added a commit that referenced this pull request Feb 10, 2026
Add E2E tests for default auth functionality in wallet package.

Tests cover:
- Auth instance creation with auto-configuration
- ClientId auto-detection (sandbox vs production)
- PassportDomain derivation from chain config
- Popup callback handling for OAuth flow
- Query string management during auth callback
- Provider creation without external getUser
- Error handling for auth failures

This validates the default auth implementation added by Shine Li
in PR #2768 (feat(passport): nextjs packages).

All 28 tests passing:
- 7 tests for Auth instance creation
- 6 tests for clientId auto-detection
- 4 tests for popup callback handling
- 4 tests for provider creation
- 2 tests for error handling
- 5 tests for existing functionality

Co-authored-by: Cursor <cursoragent@cursor.com>
rodrigo-fournier-immutable added a commit that referenced this pull request Feb 10, 2026
…etection

Implement default authentication for auth-next-client/server packages
to provide zero-config setup for developers.

auth-next-server changes:
- Add createDefaultAuthConfig() function with optional configuration
- Auto-detect clientId based on environment (sandbox vs production)
- Auto-derive redirectUri from window.location.origin + '/callback'
- Export default client IDs and constants for consumer use
- Uses public Immutable client IDs for development convenience

auth-next-client changes:
- Update useLogin hook to accept optional config (all fields)
- Update useLogout hook to accept optional config
- Add helper functions to create complete configs with defaults
- Auto-detect clientId, redirectUri, popupRedirectUri, logoutRedirectUri
- Export default constants for direct consumer use

This enables minimal setup:
  // Server (lib/auth.ts)
  export const { handlers, auth } = NextAuth(createDefaultAuthConfig());

  // Client
  const { loginWithPopup } = useLogin();
  await loginWithPopup(); // No config needed!

  const { logout } = useLogout();
  await logout(); // No config needed!

Consumers can still override any field as needed for production use.

Related to wallet package default auth implementation (PR #2768).

Co-authored-by: Cursor <cursoragent@cursor.com>
rodrigo-fournier-immutable added a commit that referenced this pull request Feb 10, 2026
…etection

Implement default authentication for auth-next-client/server packages
to provide zero-config setup for developers.

auth-next-server changes:
- Add createDefaultAuthConfig() function with optional configuration
- Auto-detect clientId based on environment (sandbox vs production)
- Auto-derive redirectUri from window.location.origin + '/callback'
- Export default client IDs and constants for consumer use
- Uses public Immutable client IDs for development convenience

auth-next-client changes:
- Update useLogin hook to accept optional config (all fields)
- Update useLogout hook to accept optional config
- Add helper functions to create complete configs with defaults
- Auto-detect clientId, redirectUri, popupRedirectUri, logoutRedirectUri
- Export default constants for direct consumer use

This enables minimal setup:
  // Server (lib/auth.ts)
  export const { handlers, auth } = NextAuth(createDefaultAuthConfig());

  // Client
  const { loginWithPopup } = useLogin();
  await loginWithPopup(); // No config needed!

  const { logout } = useLogout();
  await logout(); // No config needed!

Consumers can still override any field as needed for production use.

Related to wallet package default auth implementation (PR #2768).

Co-authored-by: Cursor <cursoragent@cursor.com>
rodrigo-fournier-immutable added a commit that referenced this pull request Feb 11, 2026
Add E2E tests for default auth functionality in wallet package.

Tests cover:
- Auth instance creation with auto-configuration
- ClientId auto-detection (sandbox vs production)
- PassportDomain derivation from chain config
- Popup callback handling for OAuth flow
- Query string management during auth callback
- Provider creation without external getUser
- Error handling for auth failures

This validates the default auth implementation added by Shine Li
in PR #2768 (feat(passport): nextjs packages).

All 28 tests passing:
- 7 tests for Auth instance creation
- 6 tests for clientId auto-detection
- 4 tests for popup callback handling
- 4 tests for provider creation
- 2 tests for error handling
- 5 tests for existing functionality

Co-authored-by: Cursor <cursoragent@cursor.com>
rodrigo-fournier-immutable added a commit that referenced this pull request Feb 11, 2026
…etection

Implement default authentication for auth-next-client/server packages
to provide zero-config setup for developers.

auth-next-server changes:
- Add createDefaultAuthConfig() function with optional configuration
- Auto-detect clientId based on environment (sandbox vs production)
- Auto-derive redirectUri from window.location.origin + '/callback'
- Export default client IDs and constants for consumer use
- Uses public Immutable client IDs for development convenience

auth-next-client changes:
- Update useLogin hook to accept optional config (all fields)
- Update useLogout hook to accept optional config
- Add helper functions to create complete configs with defaults
- Auto-detect clientId, redirectUri, popupRedirectUri, logoutRedirectUri
- Export default constants for direct consumer use
- Align popupRedirectUri behavior with @imtbl/auth and @imtbl/wallet
  (uses same '/callback' path instead of separate '/callback/popup')

This enables minimal setup:
  // Server (lib/auth.ts)
  export const { handlers, auth } = NextAuth(createDefaultAuthConfig());

  // Client
  const { loginWithPopup } = useLogin();
  await loginWithPopup(); // No config needed!

  const { logout } = useLogout();
  await logout(); // No config needed!

Consumers can still override any field as needed for production use.

All tests passed:
✅ Zero-config login with popup
✅ Zero-config logout with federated logout
✅ Custom config overrides (partial and full)
✅ Session management
✅ Auto-detection of environment (sandbox vs production)

Related to wallet package default auth implementation (PR #2768).

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant