I am experiencing an issue accessing a specific view in my Django application as a non-logged-in user. This view is decorated with login_required. After filling in the username and password, there is an authentication error because the redirect URI does not match the redirect URI configured in Azure.
Redirect URI in Azure: http://localhost:5000/redirect

I believe the problem lies in the login function in the Auth class, as the redirect URI is being built from the request, and the redirect URI from the environment variable is no longer being used.
Expected behaviour
The redirect URI should be constructed solely from the environment variable and should not be generated from the request.
Actual behaviour
The redirect URI is being constructed from the request, leading to a mismatch with the redirect URI in Azure and consequently causing an authentication error.
Is there a way to override this part of the code so that the redirect URI is not built from the request but only from the environment variable?
I am experiencing an issue accessing a specific view in my Django application as a non-logged-in user. This view is decorated with login_required. After filling in the username and password, there is an authentication error because the redirect URI does not match the redirect URI configured in Azure.
Redirect URI in Azure: http://localhost:5000/redirect
I believe the problem lies in the login function in the Auth class, as the redirect URI is being built from the request, and the redirect URI from the environment variable is no longer being used.
Expected behaviour
The redirect URI should be constructed solely from the environment variable and should not be generated from the request.
Actual behaviour
The redirect URI is being constructed from the request, leading to a mismatch with the redirect URI in Azure and consequently causing an authentication error.
Is there a way to override this part of the code so that the redirect URI is not built from the request but only from the environment variable?