Giter Club home page Giter Club logo

wpcodevo / nextauth-nextjs13-prisma Goto Github PK

View Code? Open in Web Editor NEW
234.0 1.0 69.0 112 KB

In this tutorial, I'll walk you through setting up authentication in your Next.js 13 app directory using NextAuth.js. It's worth noting that while we use the NextAuth package in this tutorial, you may be using the Auth.js package by the time you read this, as the libraries are now interchangeable.

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

JavaScript 3.82% TypeScript 75.34% CSS 20.84%
authjs docker jwt-authentication nextauth nextauthjs nextjs nextjs13 postgres prisma session-auth

nextauth-nextjs13-prisma's Introduction

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

In this tutorial, I'll walk you through setting up authentication in your Next.js 13 app directory using NextAuth.js. It's worth noting that while we use the NextAuth package in this tutorial, you may be using the Auth.js package by the time you read this, as the libraries are now interchangeable.

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

Topics Covered

  • Setup the Next.js 13 Project
  • Setup Next Auth API Route
    • Create Reusable Buttons
  • Three Ways of Getting the NextAuth Session Data
    • Get the Session in a Server Component
    • Get the Session in an API Route
    • Get the Session in a Client Component
  • Integrate a Database
    • Setup PostgreSQL
    • Setup Prisma ORM
  • Implement the NextAuth Authentication Code
  • Store Custom Keys in the JWT
  • Different Ways to Protect Routes
    • Client-Side Route Protection
    • Server-Side Route Protection
    • Protect an API Route
    • Middleware Route Protection
  • Implement the Account Registration Logic
    • Create the API Route to Register Users
    • Create the Form Component
    • Create the Account Registration Page

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

2. Next.js - Use Custom Login and SignUp Pages for NextAuth.js

In this article, you will learn how to integrate custom login and signup pages with NextAuth.js in the new Next.js 13 app directory. Am going to assume that you have already set up NextAuth in your project and that you are only looking for a way to integrate your custom login and signup pages.

Next.js - Use Custom Login and SignUp Pages for NextAuth.js

Topics Covered

  • Run the NextAuth Project on your Computer
  • Test the NextAuth Project
    • Register an Account
    • Log into your Account
    • Access a Protected Page
  • Configure the NextAuth API Endpoint
  • Create the Custom Login Page
    • Create the Login Form
    • Create the Login Page
  • Create the Custom SignUp Page
    • Create the SignUp Form
    • Create the Account Registration Page
  • Create the API Handler for Account Registration
  • Conclusion

Read the entire article here: https://codevoweb.com/nextjs-use-custom-login-and-signup-pages-for-nextauth-js/

3. Next.js - Add Google and GitHub OAuth2 using NextAuth.js

In this article, you will learn how to integrate Google and GitHub OAuth providers with NextAuth.js in the new Next.js 13 app directory. It's worth noting that I am using a specific pull request recommended by the NextAuth team that is compatible with the new Next.js 13 app directory.

Next.js - Add Google and GitHub OAuth2 using NextAuth.js

Topics Covered

  • Run the NextAuth Project Locally
  • Explore the GitHub and Google OAuth Flow
    • Sign in with Google OAuth2
    • Sign in with GitHub OAuth
  • Configure NextAuth with Google and GitHub OAuth
  • Implement the Google and GitHub OAuth2
    • Create the Client-Side Form
    • Create the Server-Side Page Component
  • How to Generate the Google OAuth2 Credentials
  • How to Generate the GitHub OAuth Credentials
  • Conclusion

Read the entire article here: https://codevoweb.com/nextjs-add-google-and-github-oauth2-using-nextauth-js/

nextauth-nextjs13-prisma's People

Contributors

omar-salama avatar wpcodevo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

nextauth-nextjs13-prisma's Issues

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.