Git Product home page Git Product logo

vanling / nuxt-auth Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sidebase/nuxt-auth

0.0 0.0 0.0 1.93 MB

๐Ÿ” 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)

Home Page: https://sidebase.io/nuxt-auth/

License: MIT License

TypeScript 88.93% Vue 11.07%

nuxt-auth's Introduction

nuxt-auth demo page

๐Ÿ” nuxt-auth

npm version npm downloads GitHub stars License Follow us on Twitter Join our Discord

nuxt-auth is a feature-packed, open-source authentication module for Nuxt 3 applications.

Quick Start

npm i -D @sidebase/nuxt-auth

Then visit the Quick Start documentation to setup the module.

Features

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). Features of nuxt-auth include:

  • โœ”๏ธ Authentication providers:
    • โœ”๏ธ OAuth (e.g., Github, Google, Twitter, Azure, ...)
    • โœ”๏ธ Custom OAuth (write it yourself)
    • โœ”๏ธ Credentials (password + username)
    • โœ”๏ธ Email Magic URLs
  • โœ”๏ธ Isomorphic / Universal Auth Composable useSession supports:
    • actions: getSession, getCsrfToken, getProviders, signIn, signOut
    • getters: status, data, lastRefreshedAt
    • full typescript support for all methods and property
  • โœ”๏ธ Application-side middleware protection
  • โœ”๏ธ Server-side middleware and endpoint protection
  • โœ”๏ธ Advanced features for session life-cycle management:
    • Refresh the session periodically
    • Refresh the session on tab-refocus
    • One time session fetch on page load, afterwards for specific actions (e.g., on navigation)
    • ๐Ÿšง Session broadcasting between tabs (see #70)
  • โœ”๏ธ Persistent sessions across requests
  • โœ”๏ธ REST API:
    • GET /signin,
    • POST /signin/:provider,
    • GET/POST /callback/:provider,
    • GET /signout,
    • POST /signout,
    • GET /session,
    • GET /csrf,
    • GET /providers

Demo Page

Visit the nuxt-auth demo page here: nuxt-auth demo page

You can find the demo source-code here.

Development

  • Run npm run dev:prepare to generate type stubs.
  • Use npm run dev to start the module playground in development mode.
  • Run npm run lint to run eslint
  • Run npm run types to run typescheck via tsc
  • Run npm publish --access public to publish (bump version before)

Module Playground

This module also has it's own playground:

> git clone https://github.com/sidebase/nuxt-auth

> cd nuxt-auth

# **OPEN THE `~/playground/server/api/auth/[...].ts` and configure your own auth-provider

> npm i

> npm run dev:prepare

> npm run dev

# -> open http://localhost:3000

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.