How to use Django backend with React frontend

I’ve been going around in circles for how to get this project integrated correctly with Auth0 and would love some assistance.

My setup is Django as the backend with the user database. I want to keep using Django as the user database. The frontend is entirely React/Redux.
The frontend gets data via an API hosted on the same Django instance using django rest framework.

I have Auth0 integrated with Django currently and this works. I would also like to get my Frontend to be aware of the session too.

I’ve tried adding the @auth0/auth0-spa-js package but the frontend always returns false on auth0Client.isAuthenticated()

Do I need separate applications for the Django and React or can I use the same Application for both? I’m using the Django web app application currently for both.

Any guidance would be v much appreciated.

Hi @simon.wilder,

Welcome to the Community! I apologize for the delayed response.

Is this a custom db you have connected to auth0 (with pw hashes, usernames etc.) or do you mean this is where you are storing user data that is not authentication related?

Typically you would have the front end authenticate, then have the SPA get an access token to make requests to your backend API.

It sounds like you are not authenticated on the front end, so this makes sense.

How are users authenticating with the Django app? Is the django app acting as an API for your front end? if so you will want to authenticate in your react app, and send an access token to the django app when you are requesting data.

Let me know,
Dan

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