github sidebase/nuxt-auth 0.0.1-beta.1

latest releases: v1.0.2, 1.0.1, v1.0.0...
pre-release2 years ago

Nuxt user authentication and sessions via NextAuth.js. nuxt-auth wraps NextAuth.js to offer the reliability & convenience of a 12k star library to the nuxt 3 ecosystem with a native developer experience (DX).

Quick Start

  1. Install the package:
    npm i -D @sidebase/nuxt-auth
  2. Add the package to your nuxt.config.ts:
    export default defineNuxtConfig({
      modules: ['@sidebase/nuxt-auth'],
    })
  3. Done! You can now use all user-related functionality, for example:
    • client-side (e.g., from .vue files):
      const {
        status,
        data,
        signIn,
        signOut,
      } = await useSession({
        // Whether a session is required. If it is, a redirect to the signin page will happen if no active session exists
        required: true
      })
      
      // Session status: `unauthenticated`, `loading`, `authenticated`
      status.value
      
      // Session data, e.g., expiration, user.email, ...
      data.value
      
      // Start the unbranded sign-in flow
      await signIn()
      
      // Logout the user
      await signOut()

Full Changelog: https://github.com/sidebase/nuxt-auth/commits/0.0.1-beta.1

Don't miss a new nuxt-auth release

NewReleases is sending notifications on new releases.