This example demonstrates the usage of Fingerprint inside Next.js's app directory approach.
Note how you can use Fingerprint inside a React Server Component without issues as it is correctly executed in the browser only.
See ../next for an example using the classic pages approach.
In order to try out this example:
- Create a
.env(or.env.local) file in this directory. - Set the
NEXT_PUBLIC_FPJS_PUBLIC_API_KEYenvironment variable to the value of your Fingerprint Public API key.
To get the API key:
- Go to Fingerprint Dashboard > API Keys and find it there.
- If you don't have a Fingerprint account, sign up for free.
From the repository root, install dependencies and build the SDK:
pnpm install
pnpm buildAfter setting the API key, start the example:
pnpm --filter next-appDir devRuns the app in the development mode.
Open http://localhost:3003 to view it in the browser.