Coder Social home page Coder Social logo

next-auth-fullstack's Introduction

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

http://localhost:3000/api/hello is an endpoint that uses Route Handlers. This endpoint can be edited in app/api/hello/route.ts.

This project uses next/font to automatically optimize and load Inter, a custom Google Font.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

next-auth-fullstack's People

Contributors

vahid-nejad avatar

Stargazers

Akash Kumawat avatar  avatar  avatar Tawsif Haque avatar Gelson Gomes Rodrigues avatar Gio avatar Guillaume avatar Ken Osagie avatar  avatar Kishan Thachatt avatar Jason avatar Mark avatar  avatar Colton Hyland avatar Vincenzo Luca Palonsky avatar Srikanth Reddy avatar zemunkh avatar Zahid Hasan avatar Mahmud Hasan Imran avatar Revvi Sudirnoputra avatar Kapil Chaudhary avatar George Clinton avatar Abdul Malek Zihad  avatar  avatar  avatar James Ayomikun Araoye avatar  avatar Pham Quoc Bao avatar  avatar Adeth avatar Ameet Jayawant avatar Kirill Podolinniy avatar Naufal Yassar avatar Abhik Banerjee avatar Odediran Ifeoluwa avatar Moko Wiratmoko avatar Firman Ardiyansah avatar  avatar MahdiArabpour avatar  avatar Werayoot kunphai avatar Mohammad Shiran avatar Amith A G avatar Will avatar  avatar Henrique Kramer avatar Ahmad Dorri avatar Abdul Rauf avatar  avatar Alwan Wicaksono avatar Cássio Seffrin avatar Muhammad Azad avatar  avatar NewIT LoanNTK avatar Hugo Vinícius avatar  avatar CandraSetiawan avatar  avatar Killian avatar  avatar Ahmed Mohamed avatar Tanapattara Wongkhamchan avatar anhleduc avatar abjutus avatar Phan Hoang Kha Ai avatar Alberto avatar Maurice Oduor avatar Charles de Deus avatar PostPcEra avatar Dharmendra Kumar Gupta avatar  avatar Bruno avatar Iko putro utomo avatar Alexandre avatar Amirul Ikmal avatar James Aspinall avatar Francisldn avatar Ibronos avatar Maikol avatar Felipe Ma avatar Maurício El Uri avatar  avatar Izidorio Bento avatar Yu Liang avatar Danny O'Neal avatar Hozaifa Bin Masud avatar Pradeep kumar avatar Om Daryani avatar Thomson Muriyadan avatar Julian W. Wagner avatar  avatar  avatar Alper Demir avatar Muhammad Badri avatar  avatar Arthur M. Bernardino avatar Yayi Muhammed avatar Muhammad Siddique avatar David Sykes avatar Fares Galal avatar

Watchers

 avatar

next-auth-fullstack's Issues

Cannot read properties Undefined (reading "User")

Hey Guys,

I am trying to use this tutorial in my own project but I have a problem while trying to create the model. It tells me that :
TypeError: Cannot read properties of undefined (reading 'User').

There is only one component that I have changed otherwise, nextJS the framework I am using won't let it be.

So I have changed the register Page to be :
import { useEffect } from "react"; // Import useEffect
import { getServerSession } from "next-auth";
import { useRouter } from "next/router"; // Import useRouter
import { authOptions } from "../../../app/api/auth/[...nextauth]/route";
import RegisterForm from "../AuthForm/RegisterForm";

export default function Register() {
const router = useRouter(); // Initialize useRouter

useEffect(() => {
async function checkSession() {
try {
const session = await getServerSession(authOptions);

    if (session) {
      router.replace("/dashboard/Profile"); // Redirect if session exists
    }
  } catch (error) {
    console.error("Error checking session:", error);
  }
}

checkSession(); // Call the async function

}, [router]); // Make sure to include router in the dependency array

return ;
}

instead of : import RegisterForm from "@/components/RegisterForm";
import { getServerSession } from "next-auth";
import { redirect } from "next/navigation";
import { authOptions } from "../api/auth/[...nextauth]/route";

export default async function Register() {
const session = await getServerSession(authOptions);

if (session) redirect("/dashboard");

return ;
}

otherwise it tells me that : Error: Objects are not valid as a React child (found: [object Promise]). If you meant to render a collection of children, use an array instead.

Can anyone help me on this ?
test

Thanks a lot !

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.