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 views.py and put a print(request.user.username)
and print(request.user.id)
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??