nuxt-auth-pkce
TypeScript icon, indicating that this package has built-in type declarations

0.8.9 • Public • Published

Auth PKCE

npm version npm downloads License Nuxt

My new Nuxt module for doing amazing things.

Setup

  1. Add the nuxt-auth-pkce dependency to your Nuxt.js project:
npm install nuxt-auth-pkce
# or
yarn add nuxt-auth-pkce
# or
pnpm i nuxt-auth-pkce
  1. Add nuxt-auth-pkce to the modules section of nuxt.config.js:
{
  modules: [
    'nuxt-auth-pkce',
  ],
  authPkce: {
    // Options
  }
}
  1. Register your application in Azure AD and configure it as a SPA. Make sure to add the redirect URI http://localhost:3000/auth/callback to the app registration - as well as the URL you will be using in production.

  2. Create a .env file in the root of your project and add the following:

NUXT_PUBLIC_AUTH_PKCE_CLIENT_ID="your-client-id"
NUXT_PUBLIC_AUTH_PKCE_TENANT_ID="your-tenant-id"
  1. Use the AuthGate component in your application
<template>
  <AuthGate auto-login>
    <div>
      <h1>My secret content</h1>
    </div>
  </AuthGate>
</template>

Features

  • Builtin MSAL Authentication using PKCE flow
  • fetchAuth helper for authenticated requests
  • $fetchAuth method for authenticated requests

Quick Setup

Install the module to your Nuxt application with one command:

npx nuxi module add nuxt-auth-pkce

That's it! You can now use My Module in your Nuxt app ✨

Contribution

Local development
# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Release new version
npm run release

Readme

Keywords

none

Package Sidebar

Install

npm i nuxt-auth-pkce

Weekly Downloads

25

Version

0.8.9

License

MIT

Unpacked Size

15.8 kB

Total Files

17

Last publish

Collaborators

  • xmatthias