Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert-token return access_denied in facebook backend #185

Open
yunica opened this issue Jun 1, 2023 · 3 comments
Open

convert-token return access_denied in facebook backend #185

yunica opened this issue Jun 1, 2023 · 3 comments

Comments

@yunica
Copy link

yunica commented Jun 1, 2023

I went through the process in the guide and when I try keys it gives me an error.

{"error":"access_denied","error_description":"Authentication process canceled"}

I've researched in the documentation but can't find a clear answer.
Could there be an internal error?

image

@wagnerdelima
Copy link
Owner

You need to include more details about your configuration and also the exception stacktrace.

@yunica
Copy link
Author

yunica commented Jun 1, 2023

I have some details, I did the normal configuration, change the host and create an application in the admin.
I can't find documentation about this error.

settings.py

DJANGO_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "django.forms",
]

THIRD_PARTY_APPS = [
    "rest_framework",

    "captcha",
    "debug_toolbar",
 
    "oauth2_provider",
    "social_django",
    "drf_social_oauth2",
]

LOCAL_APPS = [
    "base.apps.BaseConfig",
]

INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS


TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [BASE_DIR / "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",
                # context auth
                "social_django.context_processors.backends",
                "social_django.context_processors.login_redirect",
                # custom context
            ],
        },
    },
]

REST_FRAMEWORK = {
    "DEFAULT_PERMISSION_CLASSES": (),
    "DEFAULT_AUTHENTICATION_CLASSES": (
        # 'oauth2_provider.ext.rest_framework.OAuth2Authentication',  # django-oauth-toolkit < 1.0.0
        "oauth2_provider.contrib.rest_framework.OAuth2Authentication",  # django-oauth-toolkit >= 1.0.0
        "drf_social_oauth2.authentication.SocialAuthentication",
    ),
}

AUTHENTICATION_BACKENDS = (

    # Facebook OAuth2
    "social_core.backends.facebook.FacebookAppOAuth2",
    "social_core.backends.facebook.FacebookOAuth2",
    # drf_social_oauth2
    "drf_social_oauth2.backends.DjangoOAuth2",
    # Django
    "django.contrib.auth.backends.ModelBackend",
)
# Facebook configuration
SOCIAL_AUTH_FACEBOOK_KEY = "13xxxxxxxx"
SOCIAL_AUTH_FACEBOOK_SECRET = "e5exxxxxxxxxxxxxxxxxxxxxx"
SOCIAL_AUTH_FACEBOOK_SCOPE = ["email"]
SOCIAL_AUTH_FACEBOOK_PROFILE_EXTRA_PARAMS = {"fields": "id, name, email"}

facebook app

image

requirements.txt

asgiref==3.7.2
beautifulsoup4==4.12.2
certifi==2023.5.7
cffi==1.15.1
charset-normalizer==3.1.0
cryptography==41.0.1
defusedxml==0.7.1
Deprecated==1.2.14
Django==4.2.1
django-appconf==1.0.5
django-compressor==4.3.1
django-debug-toolbar==4.1.0
django-dotenv==1.4.2
django-htmlmin==0.11.0
django-naomi==0.8
django-oauth-toolkit==2.3.0
django-querycount==0.8.3
django-ranged-response==0.2.0
django-simple-captcha==0.5.17
djangorestframework==3.14.0
drf-social-oauth2==2.1.2
ecdsa==0.18.0
html5lib==1.1
idna==3.4
jwcrypto==1.5.0
oauthlib==3.2.2
Pillow==9.5.0
psycopg2-binary==2.9.6
pyasn1==0.5.0
pycparser==2.21
PyJWT==2.7.0
python-jose==3.3.0
python3-openid==3.2.0
pytz==2023.3
rcssmin==1.1.1
requests==2.31.0
requests-oauthlib==1.3.1
rjsmin==1.2.1
rsa==4.9
six==1.16.0
social-auth-app-django==5.2.0
social-auth-core==4.4.2
soupsieve==2.4.1
sqlparse==0.4.4
typing_extensions==4.6.2
urllib3==1.26.16
webencodings==0.5.1
wrapt==1.15.0
 

host

127.0.0.1	dev.myapp.com

exception

WARNING 01/Jun/2023 12:51:01 log.py log:log_response:241  Bad Request: /auth/convert-token
WARNING 01/Jun/2023 12:51:01 basehttp.py basehttp:log_message:212  "POST /auth/convert-token HTTP/1.1" 400 79

@cloudlessdreams
Copy link

hey @wagnerdelima did figure out how to solve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants