Django - map auth0 user onto existing users in sqlite database

I’m trying to integrate auth0 with my existing django app and sqlite database. Login is working, the problem is I can’t get the usernames inputted by auth0 through request to map on to the user models already present in my db.

I have hardcoded my auth0 backend to return the user details {'username':'eq3', 'user_id':21

However when I go to and put a print(request.user.username) and print( it prints eq306fa23456g204e8c and 51 . When I go into my database, I see that it has indeed created a new user in the auth_user table, even though there’s already a user with eq3 and user id 21 in the same table. Furthermore, if I input a random username such as foobar , it will still create a new user, but it won’t add the nonsensical alphanumeric string to the username, just foobar . What is going on here? How can I get django to recognize that the username eq3 is already in the database and thus use that as the user from which to retrieve data for the app??

Hey @ludovico!

I’m not sure how it works with Python and Django but as far as your issue description goes you need to write a verification script that will check whether the user trying to login is already in your users databse or not.

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