Skip to main content

TideCloak Next.js SDK Documentation

Welcome to the TideCloak SDK documentation for Next.js. This guide is designed to help developers securely integrate authentication, session management, and role-based access control into modern Next.js applications using TideCloak.

TideCloak is a lightweight identity and encryption platform built on top of Keycloak. It enhances traditional authentication workflows with built-in token access, silent SSO, edge middleware protection, and granular data encryption using tag-based permissions.

This documentation is divided into four key sections based on best practices for developer documentation:


πŸ” Key Features​

  • Seamless login/logout with silent SSO
  • Automatic and manual token refresh
  • Tag-based data encryption/decryption
  • Role-based UI rendering and access control
  • Edge Middleware route protection
  • Simple React hooks with full token access

πŸ“˜ Tutorials​

Start with our step-by-step tutorial to quickly integrate TideCloak into your Next.js project. You'll go from installation to securing routes and managing encrypted data in minutes.


πŸ›  How-to Guides​

This how-to collects the most common TideCloak tasks for Next.js with copy-paste snippets: install or scaffold, wrap your app with TideCloakProvider, set redirect URIs, read claims/roles, refresh tokens, and encrypt/decrypt data. It shows how to gate UI with guard components, protect routes via Edge middleware, and verify tokens in API routes (App/Pages routers). There's also a quick Docker setup for a local TideCloak instance and notes on activating a dev license.


πŸ’¬ Discussions​

This page explains how TideCloak authentication works in Next.js with step-by-step flow diagrams-covering normal login, SSO, API protection, session refresh, and end-to-end encryption/decryption. It contrasts Edge middleware (route-level enforcement) with client-side auth (UI gating), and lists best practices for redirect URIs and role checks. Common pitfalls (missing /auth/redirect, incorrect E2EE roles, overly broad matchers) are highlighted to help you avoid breaking flows.


πŸ“š Reference​

A complete technical breakdown of TideCloak's Next.js SDK. Includes API methods, configuration options, hooks, components, and encryption utilities.


βœ… TideCloak Next.js Verify JWT​

A lightweight utility for server‑side verification of TideCloak‑issued JSON Web Tokens (JWTs).


For React-only or JavaScript-based applications, check out the React SDK Guide and JavaScript SDK Guide.