Skip to content

Instantly share code, notes, and snippets.

View maljukan's full-sized avatar
🏠
Working from home

Nenad Maljukan maljukan

🏠
Working from home
View GitHub Profile
@maljukan
maljukan / gist:bd8d220500158a11706cd4756890b07b
Last active January 26, 2024 14:35
Django BaseOAuth2 workaround for setting the redirect_uri to localhost
class AzureADOAuth2v2(BaseOAuth2):
# Workaround for setting the redirect_uri to localhost.
# Host is set in proxy server.py and redirect_uri takes the request host value
def get_redirect_uri(self, state=None):
"""Build redirect with redirect_state parameter."""
uri = self.redirect_uri
if self.REDIRECT_STATE and state:
uri = self.url_add_parameters(uri, {"redirect_state": state})