What application type should I choose if I have a mongoDB database with React application?

This is my first time implementing auth and everything is new to me. I’m making a Web Application in React with MongoDB in the backend(so I need to track the users data in the mongodb collection). Initially, I created a new Regular Web Application and tried to login/signup with react to test if it’s working properly but the React always threw 401 unauthorized after I tried to signup or login. I searched in the community and that tutorial was only made for the SPA application type. But I’m confused as to which application type should I choose? Would a SPA application work well if I have a backend or should I just use regular web app?

Hi @piyush.lamba,

Welcome to the Auth0 Community!

Your React app is a Single Page Application (SPA). It would typically make requests to a backend API, and that API would get data from your DB and serve it to your SPA. A common example of this is the MERN stack.

In a MERN example, Auth0 would function by authenticating users in the SPA, and a token would be sent with requests from the SPA to the backend API and verified.

Here is our example of that type of arch:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.