nuxt-auth-pkce
Auth PKCE
My new Nuxt module for doing amazing things.
Setup
- Add the
nuxt-auth-pkcedependency to your Nuxt.js project:
npm install nuxt-auth-pkce
# or
yarn add nuxt-auth-pkce
# or
pnpm i nuxt-auth-pkce
- Add
nuxt-auth-pkceto themodulessection ofnuxt.config.js:
{
modules: [
'nuxt-auth-pkce',
],
authPkce: {
// Options
}
}
-
Register your application in Azure AD and configure it as a SPA. Make sure to add the redirect URI
http://localhost:3000/auth/callbackto the app registration - as well as the URL you will be using in production. -
Create a
.envfile 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"
- Use the
AuthGatecomponent 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
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 0.10.2 | ^3.0 | MIT | |
| 0.10.1 | ^3.0 | MIT | |
| 0.9.1 | ^3.0 | MIT | |
| 0.8.12 | ^3.0 | MIT | |
| 0.8.11 | ^3.0 | MIT | |
| 0.8.10 | ^3.0 | MIT | |
| 0.8.9 | ^3.0 | MIT | |
| 0.8.8 | ^3.0 | MIT | |
| 0.8.7 | ^3.0 | MIT | |
| 0.8.6 | ^3.0 | MIT | |
| 0.8.5 | ^3.0 | MIT | |
| 0.8.4 | ^3.0 | MIT | |
| 0.8.3 | ^3.0 | MIT | |
| 0.8.2 | ^3.0 | MIT | |
| 0.8.1 | ^3.0 | MIT | |
| 0.8.0 | ^3.0 | MIT |