Static application landing page
Use a consistent landing page such as /dashboard after every successful login.
Kinde · Pipe
KINDE_POST_LOGIN_REDIRECT_URL is an environment variable that sets where users go after authenticating. The Next.js App Router SDK also supports a per-login destination through post_login_redirect_url or postLoginRedirectURL.
This environment variable defines the destination users reach after authenticating. In the Next.js App Router SDK, it provides a static default, while the post_login_redirect_url login parameter can select a route-specific destination; the destination must be configured appropriately for the application and deployment.
KINDE_POST_LOGIN_REDIRECT_URL=<post-login-url>postLoginRedirectURL for choosing the destination dynamically.// .env.local
KINDE_POST_LOGIN_REDIRECT_URL=http://localhost:3000/dashboard
// app/page.tsx
import { redirect } from "next/navigation";
export default function Home() {
redirect("/api/auth/login?post_login_redirect_url=/dashboard");
}Set the environment variable for a fixed destination, or add the query parameter when initiating login for a route-specific destination.
Use a consistent landing page such as /dashboard after every successful login.
Send users back to the protected route they attempted to open before authentication.
Use separate destinations or host values for local, production, and preview deployments.
It is an environment variable that sets a fixed destination after users log in. In the Next.js App Router SDK, define it in .env.local, such as /dashboard represented by the application URL.
Follow-up: How would you support different destinations? Use the post_login_redirect_url query parameter when redirecting to the login endpoint, allowing the initiating route to specify its post-login destination.
A static redirect applies one configured destination to the application. A dynamic redirect passes post_login_redirect_url during login, so the destination can vary by request.
Follow-up: What deployment issue can affect the static approach? Preview domains can differ, so the variable should be set dynamically from the domain initiating the authentication flow.
The login request can include post_login_redirect_url, for example /api/auth/login?post_login_redirect_url=/dashboard. Kinde then uses that value to return the user to the requested route after authentication.
Follow-up: What should be checked when redirects fail? Verify the destination and deployment domain against the application's configured Kinde redirect settings.
KINDE_SITE_URLKINDE_REDIRECT_URLKINDE_POST_LOGOUT_REDIRECT_URLpostLoginRedirectURLpost_login_redirect_url