nuxt-oidc-auth
[](https://nuxt.com/modules/nuxt-oidc-auth) # Nuxt OIDC Auth [![npm version][npm-version-src]][npm-version-href] [![npm downloads][npm-downloads-src]][npm-downloads-href] [![License][license-src]][license-href] [![Nuxt][nuxt-src]][nuxt-href] Welcome to **Nuxt OIDC Auth**, a Nuxt module focusing on native OIDC (OpenID Connect) based authentication for Nuxt with a high level of customizability and security for SSR applications. This module doesn't use any external dependencies outside of the [unjs](https://unjs.io/) ecosystem except for token validation (the well known and tested `jose` library for JWT interactions). π [Documentation](https://nuxtoidc.cloud/) ## Features β©οΈ Automatic session and token renewal<br> πΎ Encrypted server side refresh/access token storage powered by Nitro storage<br> π Token validation<br> π Secured & sealed cookies sessions<br> βοΈ Presets for popular OIDC providers<br> π€ Global middleware with automatic redirection to default provider or a custom login page (see playground)<br> π€ `useOidcAuth` composable for getting the user information, logging in and out, refetching the current session and triggering a token refresh<br> ποΈ Multi provider support with auto registered routes (`/auth/<provider>/login`, `/auth/<provider>/logout`, `/auth/<provider>/callback`)<br> π Generic spec OpenID compatible connect provider with fully configurable OIDC flow (state, nonce, PKCE, token request, ...)<br> π Session expiration check<br> ## Installation ### Add `nuxt-oidc-auth` dependency to your project With nuxi ```bash pnpm dlx nuxi@latest module add nuxt-oidc-auth ``` or manually ```bash pnpm add nuxt-oidc-auth ``` Add `nuxt-oidc-auth` to the `modules` section of `nuxt.config.ts` ```js export default defineNuxtConfig({ modules: ['nuxt-oidc-auth'], }) ``` ## β οΈ Disclaimer This module is still in development, feedback and contributions are welcome! Use at your own risk. <!-- Badges --> [npm-version-src]: https://img.shields.io/npm/v/nuxt-oidc-auth?labelColor=18181B&color=28CF8D [npm-version-href]: https://npmjs.com/package/nuxt-oidc-auth [npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-oidc-auth?labelColor=18181B&color=28CF8D [npm-downloads-href]: https://npmjs.com/package/nuxt-oidc-auth [license-src]: https://img.shields.io/npm/l/nuxt-oidc-auth?labelColor=18181B&color=28CF8D [license-href]: https://npmjs.com/package/nuxt-oidc-auth [nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js [nuxt-href]: https://nuxt.com