inai-nextjs-sdk

Integrate InAI Auth into Next.js apps with provider, middleware, API routes, and hooks.

Updated Mar 14, 2026
One-click install
npx skills add https://github.com/InAI-Team/inai-auth-skills --skill inai-nextjs-sdk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: inai-nextjs-sdk
Source: https://github.com/InAI-Team/inai-auth-skills/tree/main/skills/inai-nextjs-sdk
Command: npx skills add https://github.com/InAI-Team/inai-auth-skills --skill inai-nextjs-sdk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Reduces the complexity of adding secure authentication, RBAC, MFA, and session management to Next.js apps by providing a ready-to-use InAI Auth integration with provider, middleware, API routes, and client/server helpers.

Core Features & Use Cases

  • Provider: wrap your app with InAIAuthProvider to hydrate and manage auth state.
  • API Routes & Middleware: automatic login/register/MFA/refresh/logout flows and route protection for both app users and platform admins.
  • Server & Client Helpers: server(auth/currentUser/configureAuth) and client hooks for streamlined auth work.

Quick Start

Install the Next.js integration package and wrap your app with InAIAuthProvider to enable authentication flows.

Frequently Asked Questions about inai-nextjs-sdk

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add authentication and RBAC to a Next.js application?

To add authentication and RBAC to a Next.js application, you wrap your app with InAIAuthProvider and configure middleware. This integration provides automatic login, register, MFA, and route protection flows for both app users and platform admins.

How does session management work with Next.js middleware and API routes?

Session management works with Next.js middleware by automatically handling login, register, MFA, refresh, and logout flows via API routes. This protects routes for both app users and platform admins while maintaining session state.

Can I use Next.js server and client helpers for MFA and auth state?

Yes, you can use Next.js server and client helpers for MFA and auth state. The integration provides server helpers like auth, currentUser, and configureAuth, alongside client hooks, to streamline authentication work across your components.

What is the best way to set up platform admin and app user auth contexts in Next.js?

The best way to set up platform admin and app user auth contexts in Next.js is using a dedicated auth provider integration. This automatically configures distinct API routes and middleware to protect routes and manage sessions across both user contexts.

Do I need to manually build login and refresh flows for Next.js authentication?

No, you do not need to manually build login and refresh flows for Next.js authentication. The integration provides automatic login, register, MFA, refresh, and logout flows through pre-configured API routes and middleware.