Skip to content

Configure Authenitcation in Nextjs 13 App router Applicationwith Keycloak

Notifications You must be signed in to change notification settings

harshbhandarivs/nextjs-keycloak

Repository files navigation

Blog

This repository is a part of a blog which explains how to use keycloak as a authentication broker for a NextJS v13 application. Please go through this blog

Getting Started

Run keycloak with a postgres database

docker compose up -d

Please note that the above method cannot be used for production.

Run the development server

NODE_OPTIONS='--dns-result-order=ipv4first' npm run dev

To build the project

npm run build

Open http://localhost:3000 with your browser to see the result.

To start the nextjs server(production mode)

NODE_OPTIONS='--dns-result-order=ipv4first'  npm start

Make sure to setup the environment variables.