Example application using Hellō
👀 Online demo at https://next-with-hello.vercel.app
This example creates an authentication system that uses Hellō for user login and retrieving user claims. User data is then stored in a signed and encrypted session cookie with iron-session
. The authentication and session functionality is implemented in nextjs-hello
- see that package's README for more documentation.
It is based off the Single Page Hellō Demo App and the with-iron-session Next.js example.
Features of the example:
- Login and update the user's profile with Hellō.
- Login redirects and return URLs for both statically generated and server-side rendered pages.
- The logged in status is synchronized between browser windows/tabs using the
useUser
hook. - Session data is signed and encrypted in a cookie.
Several environment variables should be configured in Vercel:
- If you have not yet set the
HELLO_CLIENT_ID
environment variable, you'll be prompted to create a new quickstart application upon login. In development, the client ID will be automatically written to the.env
files. In production, you'll need to set theHELLO_CLIENT_ID
environment variable to the client ID provided by Hellō and redeploy. - Set the
HELLO_BASE_URL
environment variable to your app's Vercel URL, e.g.https://next-with-hello.vercel.app
. - Set the
HELLO_SESSION_SECRET
to a random string.
You can view/configure your Hellō application via the Hellō developer console.
- Clone the repo/deploy your own. (You'll have to fork the repo if you want to submit PRs)
yarn install
- You might have to update node with
nvm install --lts
andnvm use --lts
yarn dev