How to redirect to homepage in django-microsoft-auth if there is no next parameter?

I registered the app in Azure AD and configured my Django app so I can log in using a Microsoft account. The problem I am facing is changing the redirect from the admin page to my homepage.

Mu redirect URI on Azure looks like this:

https://localhost:8000/microsoft/auth-callback/

What do I need to do to change the redirect to https://localhost:8000/home

After a few days of researching I cloned the repository and found in the login.js file this piece of code:

// redirect to next URL if it was provided
let new_path = this.parseGETParam('next') || '/admin';
window.location = origin + new_path;

The only thing to do is to change /admin to /home or whatever path you want to put. No need to change anything in the callback function.

I hope it will help someone.

Back to Top