Please help me with this simple Django app that uses 2FA integration with Duo

I'm a junior Python developer with less than a year's experience in Python. I've been given a task to create a login page using Django and then integrate it with Duo for 2 factor authentication. I've managed to create a simple login page with 1FA, but I'm stuck on trying to incorporate Duo into it.

Here's a link to the code which I've got -

I'm quite new to this, so please let me know if you need any more info or if anything in the links is not accessible.

The expecation is that the user visits the /duo/login endopoint, provides their details, it directs them to the Duo 2FA page where they get authenticated, and then it needs to go to the home.html page.

I'm using this package for Duo -

I've done everything in the link like add the parameters to the file and add the path into the file, but I'm getting this error when I try to log in :

{"error": "invalid_grant", "error_description": "Invalid redirect URI ''."}

I'm not sure what I'm missing, so any guidance would be much appreciated.

Back to Top