{"id":16730,"library":"next-auth-client","title":"NextAuthClient - Deprecated Client for NextAuth","description":"The `next-auth-client` package served as a client-side library for the `next-auth` authentication module, primarily intended for use with `next-auth` versions prior to 1.5.0. Its purpose was to provide utility functions and client-side integration points for managing user sessions and authentication flows within applications leveraging the `next-auth` backend. The current stable version of this specific client library is 1.5.0. However, as of `next-auth` version 1.5.0, the core functionality of `next-auth-client` was absorbed directly into the main `next-auth` package itself, rendering this standalone client library redundant and unmaintained. Consequently, it has no active release cadence and developers are strongly advised against using it for any new or existing projects, and should instead opt for the client utilities bundled directly with `next-auth` (i.e., `import { NextAuth } from 'next-auth/client'`). Its key differentiator was being a separate, lightweight client, but this distinction no longer exists.","status":"deprecated","version":"1.5.0","language":"javascript","source_language":"en","source_url":"https://github.com/iaincollins/next-auth-client","tags":["javascript"],"install":[{"cmd":"npm install next-auth-client","lang":"bash","label":"npm"},{"cmd":"yarn add next-auth-client","lang":"bash","label":"yarn"},{"cmd":"pnpm add next-auth-client","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is deprecated. Its functionality moved to 'next-auth/client' as of next-auth@1.5.0. Do not use for new projects; this import pattern is for historical reference only.","wrong":"const NextAuth = require('next-auth-client')","symbol":"NextAuth","correct":"import { NextAuth } from 'next-auth-client'"}],"quickstart":{"code":"// WARNING: This package is deprecated and should not be used in new projects.\n// Its functionality has been integrated directly into the 'next-auth' package.\n//\n// This quickstart demonstrates the *historical* usage of the next-auth-client package.\n//\n// In an older client-side application context (e.g., a React component):\nimport { NextAuth } from 'next-auth-client';\n\nasync function checkAuthenticationStatus() {\n  try {\n    // Attempt to get the session from the next-auth backend via this client.\n    // In a real application, this would typically be called on page load\n    // or when authentication status needs to be verified.\n    const session = await NextAuth.getSession();\n\n    if (session) {\n      console.log('User is authenticated.');\n      console.log('Session details:', session);\n      if (session.user && session.user.email) {\n        console.log(`Welcome back, ${session.user.email}!`);\n      }\n    } else {\n      console.log('User is not authenticated.');\n      // Example: Redirect to login page in a real app\n      // NextAuth.redirect({ url: '/api/auth/signin' });\n    }\n  } catch (error) {\n    console.error('Error checking authentication status:', error);\n  }\n}\n\n// Simulate calling this function, e.g., on initial application load or component mount\ncheckAuthenticationStatus();\n\n// Other typical client-side actions (for historical context):\n// NextAuth.signin('github'); // Initiates OAuth sign-in\n// NextAuth.signout();      // Initiates sign-out\n// const csrfToken = await NextAuth.getCsrfToken(); // Fetches CSRF token for forms","lang":"javascript","description":"Demonstrates the historical client-side usage of the `NextAuth` object from this deprecated package to retrieve session information."},"warnings":[{"fix":"Migrate your application to use the client utilities bundled with `next-auth`. Specifically, replace `import { NextAuth } from 'next-auth-client'` with `import { NextAuth } from 'next-auth/client'` and remove `next-auth-client` from your project's dependencies.","message":"The `next-auth-client` package is deprecated and no longer maintained. Its functionality has been merged directly into the main `next-auth` package itself, starting from `next-auth@1.5.0`. Using this package will lead to outdated or broken authentication flows and potential security vulnerabilities.","severity":"breaking","affected_versions":">=1.5.0"},{"fix":"Immediately cease using this package. Ensure your `next-auth` dependency is up-to-date and leverage its built-in client-side exports for authentication management.","message":"Continuing to use `next-auth-client` after `next-auth@1.5.0` will result in code that is incompatible with newer `next-auth` server-side implementations and will not receive any updates, bug fixes, or security patches.","severity":"gotcha","affected_versions":">=1.5.0"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[],"ecosystem":"npm"}