Giter Site home page Giter Site logo

wpcodevo / nextauth-nextjs14-prisma Goto Github PK

View Code? Open in Web Editor NEW
12.0 1.0 8.0 187 KB

In this tutorial, you will learn how to set up NextAuth v5 in Next.js 14. With the release of NextAuth v5, a couple of breaking changes have been introduced, and getting NextAuth up and running in a Next.js 14 project requires a bit of setup.

Home Page: https://codevoweb.com/setup-and-use-nextauth-in-nextjs-14-app-directory/

Makefile 1.91% TypeScript 96.09% CSS 0.25% JavaScript 1.75%
authjs nextauth nextauthjs nextjs14 nextjs14-typescript postgres prisma

nextauth-nextjs14-prisma's Introduction

1. Setup and Use NextAuth.js in Next.js 14 App Directory

In this tutorial, you will learn how to set up NextAuth v5 in Next.js 14. With the release of NextAuth v5, a couple of breaking changes have been introduced, and getting NextAuth up and running in a Next.js 14 project requires a bit of setup.

Setup and Use NextAuth.js in Next.js 14 App Directory

Topics Covered

  • How to Run the Next.js Application on Your Machine
  • Bootstrap the Next.js 14 Project
  • Install the Required Dependencies
  • Initialize NextAuth.js in Next.js 14
  • Set up Prisma for Database Interactions
    • Set up PostgreSQL with Docker
    • Set up Prisma and Prisma Client
  • Hack Around the Account Registration
  • Implement Credentials Authentication
  • Implement Google and GitHub OAuth
  • Three Ways of Fetching the NextAuth Session Data
    • Retrieving the Session in a React Server Component
    • Retrieving the Session in an API Route
    • Retrieving the Session in a React Client Component
  • How to Add Custom Data to the Session Data
  • Three Ways of Protecting Routes with NextAuth
    • Client-Side Route Protection
    • Server-Side Route Protection
    • Middleware Route Protection
  • Creating a Custom Registration Page
    • Create the Account Registration API Route
    • Create the Form Component
    • Create the Page Component
  • Conclusion

Read the entire article here: https://codevoweb.com/setup-and-use-nextauth-in-nextjs-14-app-directory/

2. Implement Authentication with NextAuth in Next.js 14

In this tutorial, you'll discover how to set up NextAuth v5 in Next.js 14, configure Prisma ORM for database interactions, implement user registration and login, and secure routes using Next.js middleware with NextAuth.

Implement Authentication with NextAuth in Next.js 14

Topics Covered

  • Running the Project on Your Computer
  • Demo of the Authentication Flow
  • Configuring Tailwind CSS
  • Setting up a PostgreSQL Server with Docker Compose
  • Creating Prisma Models for NextAuth
  • Initializing NextAuth.js in Next.js 14
  • Implementing Credentials Authentication with NextAuth
  • Creating a Header Component
  • Creating Zod Validation Schemas
  • Implementing Account Registration
    • Creating the Account Registration API Route
    • Creating the Account Registration Form
    • Creating the Page Component
  • Implementing User Sign-in with NextAuth
    • Creating the Account Login Form
    • Creating the Page Component
  • Protecting Routes with NextAuth Middleware
  • Creating a Protected Page
  • Conclusion

Read the entire article here: https://codevoweb.com/implement-authentication-with-nextauth-in-nextjs-14/

3. Set up Google and GitHub OAuth with NextAuth in Next.js 14

In this comprehensive guide, you will learn how to set up Google and GitHub OAuth with NextAuth v5 in your Next.js 14 project. Incorporating OAuth sign-in options into your application can eliminate the need for users to sign in with their email and password.

Set up Google and GitHub OAuth with NextAuth in Next.js 14

Topics Covered

  • How to Run the Project on Your Computer
  • Demo of the OAuth Flow
  • Obtaining Google and GitHub OAuth Credentials
    • Google OAuth Client ID and Secret
    • GitHub OAuth Client ID and Secret
  • Initializing NextAuth.js in Next.js 14
  • Adding Google and GitHub Providers to NextAuth
  • Modifying the JWT Payload and Session Data
  • Implementing Google and GitHub OAuth Sign-in Options
  • Protecting Routes with NextAuth Middleware
  • Conclusion

Read the entire article here: https://codevoweb.com/google-and-github-oauth-with-nextauth-in-nextjs-14/

nextauth-nextjs14-prisma's People

Contributors

wpcodevo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.