Auth0 Home Blog Docs

Django backend, VueJS front end, and user database -- whats the flow?

vuejs
django

#1

I’m new to Auth0 and trying to understand how it fits in to the flow of a new project I’m working on. Here’s the layout:

  • VueJS client on the frontend. No Server Side Rendering
  • Django on the backend, using DRF and JWT.
  • Users are associated with certain clients to limit access, so a user database with these relationships must be maintained.

I’m trying to understand how the architecture fits together. I have my VueJS app authenticating to Auth0, no problems. But my Django application knows nothing of the Auth0 user.

Django has the remote user option as described here https://auth0.com/docs/quickstart/backend/django/01-authorization. However, that is django authenticating not the Vue frontend.

Do I use the custom database option https://auth0.com/docs/connections/database/custom-db

So how does this go together? If I authenticate VueJS to Auth0, how does Django know the token is valid? Do I go vue->django->Auth0? Seems clunky?

I expect this has been done before, I’d just like some guidance on the correct path to take?

Many thanks for any assistance.

Andrew


#2

Hi Andrew,

You need to use the implicit flow - designed for SPAs (really, any application where the logic is implemented on the client side accessing an API on the server side).

This tutorial will help:

In this tutorial, the API is your Django backend.

John