Plannorium Identity Integration Guide
This guide explains how to configure other Plannorium applications (Dashboards, Mobile Apps, etc.) to use Plannorium Identity as their authentication provider.
1. Prerequisites
Ensure you have a valid Client ID and Client Secret created in the Plannorium Identity database.
- Client ID: e.g.,
plannorium-dashboard-v1 - Client Secret: (secret)
- Redirect URIs: e.g.,
http://localhost:3000/api/auth/callback/plannorium
3. Application Usage
In your application's api/auth/[...nextauth]/route.ts:
app/api/auth/[...nextauth]/route.ts
import NextAuth from "next-auth";
import { authOptions } from "@plannorium/auth-config";
const handler = NextAuth(authOptions);
export { handler as GET, handler as POST };4. Environment Variables
.env
PLANNORIUM_IDENTITY_URL=https://id.plannorium.com
PLANNORIUM_CLIENT_ID=your-client-id
PLANNORIUM_CLIENT_SECRET=your-client-secret
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your-random-secret5. Testing the Flow
- User clicks "Sign in with Plannorium" in your App.
- Redirects to
id.plannorium.com/oauth/authorize. - If not logged in,
id.plannorium.comredirects to/login. - User logs in at
id.plannorium.com. - User is redirected back to
/authorize, which approves the request. - User is redirected back to your App (
/api/auth/callback/plannorium). - NextAuth completes the exchange and creates the session.