Django Template login.html does not exist Okta Auth

I've been trying to implement Okta Auth for authentication on my Django web application. Currently I am running into the following error: django.template.exceptions.TemplateDoesNotExist: okta_oauth2/login.html.

Here are the relevant settings.py:

AUTHENTICATION_BACKENDS = ("okta_oauth2.backend.OktaBackend",)

OKTA_AUTH = {
    "ORG_URL": "https://{org}.okta.com/",
    "ISSUER": "https://{org}.okta.com/oauth2/default",
    "CLIENT_ID": os.getenv('okta_client_id'),
    "CLIENT_SECRET": os.getenv('okta_secret_id'),
    "SCOPES": "openid profile email offline_access", # this is the default and can be omitted
    "REDIRECT_URI": "http://localhost:8000/accounts/oauth2/callback",
    "LOGIN_REDIRECT_URL": "/", # default
    "CACHE_PREFIX": "okta", # default
    "CACHE_ALIAS": "default", # default
    "PUBLIC_NAMED_URLS": (), # default
    "PUBLIC_URLS": (), # default
    "USE_USERNAME": False, # default
}
....
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
                'django.template.context_processors.request',
            ],
        },
    },
]

Directory structure:

root -- > app1 --> templates --> app1 --> several HTML files (django is able to find these templates).

root -- > okta_oath2 --> templates -- > okta_oath2 --> login.html

I have tried placing the login.html in several different places but can't seem to figure out where it should go. The debug log keeps giving me the same error.

Back to Top