You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(auth-next-client,auth-next-server): add default auth with auto-detection
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>
0 commit comments