Overview
Authenticate users, read the session, and protect UI in React single-page applications using MonoCloud.
MonoCloud’s React SDK lets you add authentication to your React single-page application.
Use it to:
- Authenticate users
- Keep users signed in across page reloads and tabs
- Access the signed-in user anywhere in your component tree
- Conditionally render or gate UI based on authentication and group membership
- Call your protected APIs with access tokens
The SDK builds on top of @monocloud/auth-web-js, reusing the same browser implementation (PKCE, redirects, popups, silent refresh, and cross-tab coordination) while providing a React provider, hooks, and components.
Install the SDK
Install the SDK using your package manager:
npm install @monocloud/auth-reactView the source on GitHub: monocloud/auth-js
Get started quickly
Start with the quickstart to see MonoCloud in action:
The quickstart walks you from a new Vite + React app to a signed-in user in a few minutes.
Before you continue
To integrate MonoCloud into your own app:
- Follow the installation and configuration guide.
- Use the guides below to build out your app's authentication flow.
Guides
- Read the authentication state - Access the user, session, and tokens with the
useAuth()hook - Sign in, sign up, and sign out - Trigger authentication flows with components and hook actions
- Protected component - Conditionally render UI based on authentication and group membership
- Handle sign-in and sign-out callbacks - Process callbacks automatically or on a dedicated route, and integrate with a client-side router
API Reference
View all exported provider, hooks, components, and types: