Skip to main content

Next.js

A Next.js app with a sign-in card, a user button and a callback page, ready for server-side sessions.

StarterDraftView source
This page is a draft. The code exists, and not all of it has been run for this page yet. The page says what was checked.
Works with
JavaScript / TypeScriptNext.js

What you get​

  • A page with the sign-in card for a signed-out visitor and the user button for a signed-in one.
  • A layout with the provider.
  • A callback page.
  • Three settings in .env.local, filled in by the command.

Create it​

Install the lumo CLI, then run:

lumo init --framework next

The command asks for your organization and the client ID, and writes the project and its .env file.

Settings​

VariableValue
NEXT_PUBLIC_LUMOAUTH_DOMAINhttps://app.lumoauth.dev
NEXT_PUBLIC_LUMOAUTH_ORG_IDYour organization.
NEXT_PUBLIC_LUMOAUTH_CLIENT_IDThe client ID of the application.

Files​

FileWhat it does
app/layout.tsxThe provider.
app/page.tsxThe sign-in card and the user button.
app/auth/callback/page.tsxThe callback page.

Next steps​

Where the code is today​

lumo init --framework next writes this project. The example app of the SDK, sdk-js/examples/nextjs, adds server-side sessions and shows every component and hook.