General workflow for Auth0 with a seperated frontend and backend not clear

I am trying to build a little MVP but I can’t see a clear path yet on how to approach that with using Auth0.

The project:

  • frontend (NextJS)
  • seperated backend (Express, Prisma)

Current mental model
I don’t want to build the login/logout/forgot your email jazz by myself so I looked for something like Auth0. Usually when you build such things yourself you use email/password, JWTs and keep a User entity/model in your backend. That user often then has relations/associations to other entities/models. A User (or author) for example can have multiple books.

The confusion
Now when I use Auth0 I don’t have that User model anymore. Auth0 takes care of that. However I still need to somehow keep track of my users and have them identifiable (authenticated) in my backend, so I still need to have a simplified User entity/model in my backend am I right in that assumption? If so, how are you doing this: What fields does your User have and what data do you use to identify them in your backend? Do I then have to use Auth0 in my NextJS frontend aswell as in the backend to authenticate them? Do I need a webhook that creates a User with the uniquely identifying fields in my backend whenever a User signs up through Auth0, is that the right approach?

Usually for example when a User deleted a book of his he sent a POST to my backend, I decrypt their JWT, check whether its really them and allow that deletion. What do I send if I use Auth0 for that?

I found this tutorial: React (JavaScript) + Express.js (JavaScript) Security: Basic Access Control for Hello World Full-Stack App however it didn’t clear up the fog in my mental model regarding Auth0. The React and Express example projects use custom hooks and boilerplate code thats hard to read through, also when clicking on profile/external API in the given example frontend nothing happens and theres no explanation on how to continue. Also I am not sure how I would transfer all that boilerplate code to NextJS as its also essentially running NodeJS and serving React. Is there a dead simple example project with NextJS frontend/Express backend you know of?

Any help and explanation would be greatly appreciated.

Thanks in advance :heart:

Duplicate of General workflow for Auth0 with a seperated frontend + backend not clear