January 22, 2025   -   David Oyinbo

Auth module for Nuxt server apps

Authentication module for Nuxt 3 apps: Local login, GitHub/Google providers, token handling, route/global middlewares, and a small set of composables.

TypeScriptNuxt 3AuthLibraryNPM

Overview

Supports Local auth (login/logout/user/refresh), GitHub and Google providers, token persistence (cookies), redirects, $authFetch client, and route/global middlewares. Ships with TypeScript types and works in server apps.

Highlights

Providers

  • Local auth (login, logout, user, refresh)
  • GitHub & Google OAuth
  • Configurable endpoints and scopes

Middlewares + Tokens

  • Route and global middlewares (auth, auth-guest)
  • Cookie-based tokens with max age and token type
  • Redirects for logged-in/out states

Minimal usage

nuxt.config.tsts
export default defineNuxtConfig({
  modules: ["@workmate/nuxt-auth"],
  auth: {
    apiClient: {
      baseURL: "http://localhost:8080/api/v1", // set to your backend base URL
    },
    providers: {
      local: {
        endpoints: {
          signIn: {
            path: "/api/auth/login/password",
            method: "POST",
            tokenKey: "token",
            refreshTokenKey: "refresh_token",
            body: { principal: "email_address", password: "password" },
          },
          user: { path: "/api/auth/user", userKey: "user" },
        },
      },
    },
  },
});
// In a component/composable
const { login, loggedIn } = useAuth();
await login("local", { principal, password });

// Authenticated fetch helpers
// 1) useAuthFetch: composable that behaves like useFetch but sends the auth header
const { data: me } = await useAuthFetch("/api/auth/user");

// 2) $authFetch: $fetch-style helper that sends the auth header
const { $authFetch } = useNuxtApp();
await $authFetch("/api/protected");

Other Projects

June 1, 2022

iPay (Nuxt 3 Pet Project)

A simple Nuxt 3 site built to explore the Nuxt 3 ecosystem, routing, layouts, and component patterns.

Nuxt 3VuePet Project
April 3, 2026

distkit

Distributed systems primitives for Rust. Strict and lax counters, instance-aware counters with automatic dead-instance cleanup, and sliding-window rate limiting, all backed by Redis.

RustRedisDistributed Systems
June 27, 2025

Actix Web Starter Template

Production-ready Rust/Actix Web REST API starter with RBAC auth, SeaORM/PostgreSQL, Kafka-based email, and Docker tooling.

RustActix WebSeaORM

Let's build something together

Available for senior engineering roles, consulting, and architecture reviews.

© 2026 David Oyinbo