OASIS Avatar SSO SDK - Next.js

Complete Next.js integration for OASIS Avatar Single Sign-On with App Router and Pages Router support.

Installation

npm install @oasis/avatar-sso-nextjs

Quick Start (App Router)

1. Create Provider Component

// app/providers.tsx
'use client';

import { OasisSSOProvider } from '@oasis/avatar-sso-nextjs';

export function Providers({ children }: { children: React.ReactNode }) {
  return (
    <OasisSSOProvider
      apiUrl={process.env.NEXT_PUBLIC_OASIS_API_URL || 'https://api.oasis.network'}
      provider="Auto"
    >
      {children}
    </OasisSSOProvider>
  );
}

2. Wrap Root Layout

3. Use in Components

4. Protected Routes with Middleware

Server-Side Authentication

API Route Handler

Server Component with Auth

Pages Router Support

Features

App Router & Pages Router - Full support for both 🔐 Server-Side Auth - Secure cookie-based authentication 🚀 TypeScript - Complete type safety 🎯 Middleware Support - Easy route protection 📱 SSR & SSG - Server-side rendering compatible

API Reference

Client Components

Server Actions (App Router)

Environment Variables

License

MIT © OASIS Team

Last updated