jackkweyunga / nextjs-keycloack-example

An example nextjs 13 application that authenticates using keycloak

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NEXTJS KEYCLOACK EXAMPLE

A demonstration on how nextjs application can be configured to work with a keycloak OIDC server to achieve a kind of authentication used in the microservices' architecture.

next-auth is used together with the keycloak provider to handle authentication.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev

Make sure to add a .env file

NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=somesecret

KEYCLOAK_ISSUER=http://localhost:8080/realms/<client-id>
KEYCLOAK_SECRET=<client-secret>
KEYCLOAK_ID=<client-id>

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

About

An example nextjs 13 application that authenticates using keycloak


Languages

Language:TypeScript 68.4%Language:Dockerfile 17.8%Language:JavaScript 7.6%Language:CSS 6.1%