rohanharikr / next-with-hello

Next.js example using Hellō for authentication

Home Page:next-with-hello.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

Deploy your own

Deploy with Vercel

Several environment variables should be configured in Vercel:

  1. 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 the HELLO_CLIENT_ID environment variable to the client ID provided by Hellō and redeploy.
  2. Set the HELLO_BASE_URL environment variable to your app's Vercel URL, e.g. https://next-with-hello.vercel.app.
  3. Set the HELLO_SESSION_SECRET to a random string.

You can view/configure your Hellō application via the Hellō developer console.

Development

  1. Clone the repo/deploy your own. (You'll have to fork the repo if you want to submit PRs)
  2. yarn install
  • You might have to update node with nvm install --lts and nvm use --lts
  1. yarn dev

About

Next.js example using Hellō for authentication

next-with-hello.vercel.app

License:MIT License


Languages

Language:TypeScript 98.8%Language:JavaScript 1.2%