OpenID-Connect(OIDC) integration module for nuxt 3.0.

Overview

Nuxt OpenID-Connect

npm version

OpenID-Connect(OIDC) integration module for nuxt 3.0.

Features

  • An Nuxt 3 module.
  • OIDC integration ( implemetation base openid-client ).
  • State Management, shared login user info.
  • OIDC provider config.
  • Encrypt userInfo cookie.
  • Support browser localStorage store userInfo, which keep user auth info after page refresh. Similar like this.

Why use this module

  • The official auth module doesn't support Nuxt 3.0 yet.
  • nuxt-oidc also not support Nuxt 3.0.

How to use this module

  • Add to a project
yarn add nuxt-openid-connect
  • Then, add nuxt-openid-connect to the modules section of nuxt.config.ts and modify config depend yours:
import { defineNuxtConfig } from 'nuxt'

export default defineNuxtConfig({
  modules: [
    'nuxt-openid-connect'
  ],
  openidConnect: {
    addPlugin: true,
    op: {
      issuer: 'your_issuer_value',
      clientId: 'clientid',
      clientSecret: 'secret',
      callbackUrl: 'http://localhost:3000/oidc/cbt',
      scope: [
        'email',
        'profile',
        'address'
      ]
    },
    config: {
      secret: 'oidc._sessionid',
      cookie: { loginName: '' },
      cookiePrefix: 'oidc._',
      cookieEncrypt: true,
      cookieEncryptKey: 'bfnuxt9c2470cb477d907b1e0917oidc', // 32
      cookieEncryptIV: 'ab83667c72eec9e4', // 16
      cookieEncryptALGO: 'aes-256-cbc',
      cookieMaxAge: 24 * 60 * 60 //  default one day
    }
  }
})

Here is an using example.

💻 Development

  • Clone repository
  • Install dependencies using yarn install
  • Run npm run dev:prepare to generate type stubs.
  • Use npm run dev to start playground in development mode.

License

MIT - Made with 💚

Comments
  • feat(cookie): cookie flags support and minor fixes

    feat(cookie): cookie flags support and minor fixes

    Breaking changes

    None

    Changes

    • Support runtime configurations in playground (via .env)
    • fix response_types typo, changed to -> response_type
    • fix scopes was pilings up caused by: - defaults were always appended to configured scopes - openid was added 3 times (from defaults, configurations, and issueClient parameters)

    UPDATE 1:

    • Added support for cookie flags and its documentation to be able to secure cookies if needed, with httpOnly, and secure flags or any other flags.
    opened by KhaledAlMana 5
  • feat(debug): allow logs on debug mode only

    feat(debug): allow logs on debug mode only

    Features:

    • show logs only on debug mode [except for plugin]

    Fixes:

    • fix scopes compatibility by removing all default scopes it's breaking in 0.4.3 because some scope are added by default.
    • playground minor enhancements

    TODO:

    • debug mode for plugin.
    • fix the cookie serialization type.

    Regards,

    opened by KhaledAlMana 1
  • Latest nuxt release candidate fails

    Latest nuxt release candidate fails

    This module does not work with nuxt 3.0.0:

     ERROR  [worker reload] [worker init] The requested module 'file:///home/*********/node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs' does not provide an export named 'useCookie'                                                13:57:29
    
      import { eventHandler, setHeaders, sendRedirect, defineEventHandler, handleCacheHeaders, createEvent, getRequestHeader, getRequestHeaders, setResponseHeader, useCookie, setCookie as setCookie$1, deleteCookie, createApp, createRouter as createRouter$1, lazyEventHandler, toNodeListener, getQuery, createError } from 'node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs';
      ^^^^^^^^^
      SyntaxError: The requested module 'node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs' does not provide an export named 'useCookie'
      at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
      at async ModuleJob.run (node:internal/modules/esm/module_job:189:5)
      at async Promise.all (index 0)
      at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
      at async loadESM (node:internal/process/esm_loader:91:5)                                                                                                                                                                                                                13:57:24
      at async handleMainPromise (node:internal/modules/run_main:65:12)
    

    nuxt 3.0.0-r.11 and nuxt 3.0.0-r.12 seem ok.

    nuxt 3.0.0-r.13

     WARN  Sourcemap for "/home/kantum/depots/JobPass/jobpass/nuxt-login/node_modules/.pnpm/[email protected]/node_modules/nuxt-openid-connect/dist/runtime/plugin.mjs" points to missing source files
    

    nuxt 3.0.0-r.14 (latest)

     ERROR  Cannot read properties of undefined (reading 'openidConnect')                                                                                                                                                                                                     14:04:55
    
      at setup (node_modules/.pnpm/[email protected]/node_modules/nuxt-openid-connect/dist/module.mjs:82:94)
      at normalizedModule (node_modules/.pnpm/@[email protected]/node_modules/@nuxt/kit/dist/index.mjs:167:29)
      at async installModule (node_modules/.pnpm/@[email protected]/node_modules/@nuxt/kit/dist/index.mjs:416:3)
      at async initNuxt (node_modules/.pnpm/[email protected]/node_modules/nuxt/dist/index.mjs:1827:7)
      at async loadNuxt (node_modules/.pnpm/[email protected]/node_modules/nuxt/dist/index.mjs:1859:5)
      at async loadNuxt (node_modules/.pnpm/@[email protected]/node_modules/@nuxt/kit/dist/index.mjs:493:19)
      at async Object.invoke (node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/chunks/prepare.mjs:30:18)
      at async _main (node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/cli.mjs:50:20)
    
     ELIFECYCLE  Command failed with exit code
    

    I would love to use this module with nuxt 3.0.1 when it releases. Can you check why it does not work with rc.14?

    opened by kantum 1
  • Nuxt rc.11 compatibility

    Nuxt rc.11 compatibility

    Looks like the plugin is not compatible with last RC version of nuxt

     WARN  Module nuxt-openid-connect is disabled due to incompatibility issues:
     - [nuxt] Nuxt version `^3.0.0` is required but currently using `3.0.0-rc.11`
    
    
    opened by hgoncalves 1
  • Update callback.ts -  support response type 'code'

    Update callback.ts - support response type 'code'

    I use gravitee am with the below configurations (at end). response_type 'code' will not work because callback is always expecting access_token in params. After login, user will be redirected to the callback url with code in params. That code will be used to obtain an access token.

    I have updated this callback to be able to handle tokens.

    BIG THANK YOU FOR THIS MODULE. You have saved me a lot of time.


    openidConnect: { addPlugin: true, op: { issuer: 'https://MY_DOMAIN/am/oidc', clientId: 'CLIENT-ID-XXXXXX', clientSecret: 'CLIENT-SECRET-XXXXXX', callbackUrl: 'https://MY_DOMAIN/oidc/callback', scope: 'openid profile email', }, config: { response_type: 'code', secret: 'oidc._sessionid', cookie: {}, cookieMaxAge: 24 * 60 * 60, // default one day }, },

    opened by KhaledAlMana 0
Releases(0.4.5)
Owner
Aborn Jiang
Full stack software engineer, programer, team leader, father, thinker.
Aborn Jiang
✉️ Nuxt module for first class integration with popular newsletter providers

nuxt-newsletter Newsletter module for Nuxt 3 ✨ Release Notes ?? Read the documentation Features Nuxt 3 ready Easy integration with Mailchimp, Revue, B

Jakub Andrzejewski 39 Jan 5, 2023
Easily connect your Nuxt 3 application with LogSnag 📰

Nuxt LogSnag ?? LogSnag integration for Nuxt 3 ✨ Release Notes Features Nuxt 3 ready Easy integration Handy composables TypeScript support Setup Insta

Conner 13 Apr 28, 2022
Batteries-included, zero-config Ionic integration for Nuxt

Nuxt Ionic Ionic integration for Nuxt ✨ Changelog ?? Read the documentation ▶️ Online playground Features ⚠️ nuxt-ionic is currently a work in progres

Daniel Roe 211 Dec 28, 2022
[WIP] Firebase Integration for Nuxt(3)

Nuxt Firebase Integrate Firebase with Nuxt (3) This module is not ready for production use. Install # npm npm install -D firebase @e-chan1007/nuxt-fir

e-chan1007 5 Dec 8, 2022
Nuxt.js module to use Unleash toggle feature services

nuxt-unleash Nuxt.js module to use Unleash toggle feature services ?? Release Notes Features Use $unleash to access and handle your Unleash feature fl

Juanjo Conejero 15 Dec 3, 2022
🔎 Algolia module for Nuxt

@nuxtjs/algolia Algolia module for Nuxt ✨ Release Notes ?? Read the documentation Features Nuxt 3 ready Easy integration with Algolia Handy composable

Nuxt Community 128 Jan 7, 2023
Nuxt 3 module for Kirby's Query Language API

nuxt-kql Kirby KQL module for Nuxt 3. This module provides a useKql composable, which under the hood uses useFetch. Thus, KQL query fetching in your N

Johann Schopplich 25 Dec 15, 2022
Nuxt 3 module for Web3.js

nuxt-web3.js Nuxt 3 module for Web3.js. Installation npm install nuxt-web3.js Usage export default defineNuxtConfig({ modules: ['nuxt-web3.js'], })

Robert Soriano 8 Dec 16, 2022
🔎 Meilisearch module for Nuxt 3

nuxt-meilisearch Meilisearch module for Nuxt Features Nuxt 3 Easy integration with MeilisearchJS lib Support for Vue Algolia Vue 3 InstantSearch compo

Alex Duval 50 Dec 26, 2022
🔎 Algolia module for Nuxt

@nuxtjs/algolia Algolia module for Nuxt ✨ Release Notes ?? Read the documentation Features Nuxt 3 ready Easy integration with Algolia Handy composable

Nuxt Community 91 Jul 28, 2022
A Nuxt.js module that injects a server route to serve the GraphQL Playground

@pin-pon/nuxt-graphql-playground A Nuxt.js module that injects a server route to serve the GraphQL Playground Setup Add @pin-pon/nuxt-graphql-playgrou

Pin-Pon 3 Sep 22, 2022
Nuxt-Module, that provides a system to set shopware cache-tags for later use in e.g. a full-page cache

nuxt-shopware-caching Nuxt-Module, that provides a system to set shopware cache-tags for later use in e.g. a full-page cache. This module is meant to

Mothership GmbH 5 Nov 8, 2022
Easily connect your Nuxt3 application to your directus server. 🐰

nuxt-directus Directus Module for Nuxt 3 ✨ Release Notes ?? Read the documentation Features Nuxt3 ready Handle authentication RESTful methods TypeScri

Conner 109 Dec 28, 2022
⚡️ Minimal GraphQL Client + Code Generation for Nuxt

nuxt-graphql-client ⚡️ Minimal GraphQL Client + Code Generation for Nuxt ⚡️ Minimal GraphQL Client + Code Generation for Nuxt Features Zero Configurat

Dizzy 245 Dec 27, 2022
Easy generation of OpenGraph & Twitter meta-tags in Nuxt 3 📋

nuxt-social-tags Easy generation of OpenGraph & Twitter meta-tags in Nuxt 3 ✨ Release Notes ?? Read the documentation Features Nuxt3 ready Composables

Conner 19 Dec 17, 2022
Nuxt 3 starter with Algolia, Storyblok, and Indexer

Nuxt 3 with Storyblok CMS and Algolia Search (incl. automatic indexing) This is a demo repository for an article in Dev.to. We recommend to look at th

Jakub Andrzejewski 5 May 24, 2022
End-to-end typesafe APIs with tRPC.io in Nuxt applications.

tRPC-Nuxt End-to-end typesafe APIs with tRPC.io in Nuxt applications. The client above is not importing any code from the server, only its type declar

Robert Soriano 231 Dec 30, 2022
A modern, zero-dependency uptime monitoring tool & status page based on GitHub Actions & Nuxt Content v2.

StatusBase Uptime monitoring tool & beautiful status pages Powered by Nuxt Content v2! Free • Open Source • Notification View Demo · Report Bug · Requ

zernonia 208 Dec 27, 2022
This repo contains a fully configured nuxt 3 instance supporting TypeScript and several considered as useful libraries, fully configured and ready to use in real world projects!

Nuxt 3 Starter This repo contains a fully configured nuxt 3 instance supporting TypeScript and several considered as useful libraries, fully configure

Ali Soueidan 26 Dec 27, 2022