Facebook authentication did not work in my django project.

I got this code:

from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-h4xeevazpq7*u9b+ck=_(5o**b8x!pns2jo=*(x7bv@6p0t7im'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['127.0.0.1', 'localhost', 'mysite.com']


# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth', #authentikatsiya uchun ishlatamiz
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages', #message frameworki bu. 
    'django.contrib.staticfiles',
    #boshlandi
    'account',
    'social_django',
    'django_extensions',
  

]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware', #authenticationga service
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware', #authenticationga servic
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    
    'social_django.middleware.SocialAuthExceptionMiddleware',  # <-- Here social auth uchun
]

ROOT_URLCONF = 'bookmarks.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['templates'],
        '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',#bu messages frameworki uchun ishlaydi
                
                'social_django.context_processors.backends',  # <-- Here social auth uchun
                'social_django.context_processors.login_redirect', # <-- Here social auth uchun
            ],
        },
    },
]

WSGI_APPLICATION = 'bookmarks.wsgi.application'


# Database
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',
    }
}


# Password validation
# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/5.0/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'Asia/Tashkent'

USE_I18N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.0/howto/static-files/
MEDIA_URL='media/' #media fayllarga yo'l ko'rsatadigan url
MEDIA_ROOT='media' #asosiy local pathda joylashgan media papkaga yo'l

STATIC_URL = 'static/'
STATICFILES_DIRS=[
    'static'
]

# Default primary key field type
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

LOGIN_REDIRECT_URL = 'dashboard'
LOGIN_URL='login'
LOGOUT_URL='logout'

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

# =================DJANGO AUTHENTICATION BACKENDS ==============

AUTHENTICATION_BACKENDS=[
    'social_core.backends.facebook.FacebookOAuth2',
    'django.contrib.auth.backends.ModelBackend',
    'account.authentication.EmailAuthBackend',
    #'allauth.account.auth_backends.AuthenticationBackend',
]





# ================FACEBOOK AUTH QILISH =========== #
SOCIAL_AUTH_FACEBOOK_KEY='1119187119213012'
SOCIAL_AUTH_FACEBOOK_SECRET='76da0a6eb9806a89cfb0b7b3b6d62399'




urls.py
from django.contrib import admin
from django.urls import path, include

#media fayllar uchun chaqirilgan funksyalar
from django.conf import settings
from django.conf.urls.static import static #static productionga ketayotganda o'chiriladi. Bu only for development

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('account.urls')),
    path('social-auth/', include('social_django.urls'))#social auth uchun. Google, Facebook, Twitter
]

#media fayllarni development vaqti ishlab turishi uchun.
if settings.DEBUG:
    urlpatterns+=static(settings.MEDIA_URL, media_root=settings.MEDIA_ROOT)