inai-astro-sdk

Integrate InAI Auth into Astro 6+ SSR projects with middleware and API routes.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The Astro integration guides you to add InAI Auth to Astro 6+ SSR projects, enabling server-side authentication, route protection, and seamless session management without client-side providers.

Core Features & Use Cases

  • Integration plugin in astro.config.mjs to enable SSR authentication.
  • Middleware inaiAstroMiddleware() to guard protected routes, manage redirects, and auto-refresh tokens.
  • API Routes via createAuthRoutes() to handle login, registration, MFA, refresh, and logout.
  • Server helpers (auth(), currentUser()) accessible in Astro pages and endpoints for simple access checks.
  • Suitable for building admin panels, customer dashboards, or any SSR Astro site requiring authenticated access.

Quick Start

Install the Astro integration, configure INAI_PUBLISHABLE_KEY, and enable the middleware and API routes to protect your routes.

Frequently Asked Questions about inai-astro-sdk

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

FAQPage Schema
How do I add server-side authentication to my Astro SSR application?

To add server-side authentication to an Astro SSR application, you can use an integration plugin in astro.config.mjs along with a middleware to guard protected routes and manage session redirects without relying on client-side providers.

Does Astro 6 server-side rendering support built-in MFA and token refresh?

Yes, Astro 6+ server-side rendering supports built-in MFA and token refresh by utilizing dedicated API routes that handle login, registration, and automatic token refreshing via server middleware.

What is the best way to protect routes in an Astro SSR project?

The best way to protect routes in an Astro SSR project is by implementing server middleware that guards protected routes, manages unauthorized redirects, and auto-refreshes session tokens during server-side rendering.

Do I need a specific environment variable to configure authentication in Astro?

Yes, you need to configure the INAI_PUBLISHABLE_KEY environment variable to enable the Astro authentication plugin, which is required for the server-side integration to manage logins and sessions.

Can I check user access directly within my Astro pages and endpoints?

Yes, you can check user access directly within Astro pages and endpoints by using server helper functions like auth() and currentUser() to perform simple access checks during server-side rendering.