rsnext/examples/with-passport
2022-10-30 21:00:45 +01:00
..
components Run next/link codemod for Next.js 13 on examples (#41913) 2022-10-30 21:00:45 +01:00
lib Update authentication examples (#19330) 2020-12-29 12:43:47 -05:00
pages Update authentication examples (#19330) 2020-12-29 12:43:47 -05:00
.env Update authentication examples (#19330) 2020-12-29 12:43:47 -05:00
.gitignore Update default gitignore templates (#39051) 2022-07-26 20:08:40 -05:00
package.json Update Examples to use React 18 (#42027) 2022-10-28 17:43:20 +00:00
README.md docs(examples): improve DX while copying command to create new project (#38410) 2022-07-26 21:57:48 -05:00

Passport.js Example

This example show how to use Passport.js with Next.js. The example features cookie based authentication with username and password.

The example shows how to do a login, signup and logout; and to get the user info using a hook with SWR.

A database is not included. You can use any database you want and add it in this file.

The login cookie is httpOnly, meaning it can only be accessed by the API, and it's encrypted using @hapi/iron for more security.

Deploy your own

Deploy the example using Vercel:

Deploy with Vercel

How to use

Execute create-next-app with npm, Yarn, or pnpm to bootstrap the example:

npx create-next-app --example with-passport with-passport-app
yarn create next-app --example with-passport with-passport-app
pnpm create next-app --example with-passport with-passport-app

Deploy it to the cloud with Vercel (Documentation).