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

"'social' is not a registered namespace" when requesting social-app-django URLs #79

Open
rodgutierrez opened this issue Nov 1, 2021 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@rodgutierrez
Copy link

Hello, I'm running into issues when I send requests to any of the URLs included from social_django.urls. Requests to those URLs cause the following error:

NoReverseMatch at /auth/disconnect-backend/
'social' is not a registered namespace

I was having this problem in my production Django app, and to eliminate something wrong with my configuration as the cause, I started with a fresh project. The new project has the same issue.

Here are the installed dependencies (should only be what's required for Django, DRF, and DRF Social OAuth2):

asgiref==3.4.1
certifi==2021.10.8
cffi==1.15.0
charset-normalizer==2.0.7
cryptography==35.0.0
defusedxml==0.7.1
Deprecated==1.2.13
Django==3.2.9
django-filter==21.1
django-oauth-toolkit==1.5.0
djangorestframework==3.12.4
drf-social-oauth2==1.0.9
idna==3.3
jwcrypto==1.0
Markdown==3.3.4
oauthlib==3.1.1
pycparser==2.20
PyJWT==2.3.0
python3-openid==3.2.0
pytz==2021.3
requests==2.26.0
requests-oauthlib==1.3.0
six==1.16.0
social-auth-app-django==5.0.0
social-auth-core==4.1.0
sqlparse==0.4.2
urllib3==1.26.7
wrapt==1.13.3

Here's the diff between my changes to thesettings.py file and the fresh install version:

25d24
< 
40a40,43
>     'rest_framework',
>     'oauth2_provider',
>     'social_django',
>     'drf_social_oauth2',
65a69,70
>                 'social_django.context_processors.backends',
>                 'social_django.context_processors.login_redirect',
71c76,83
< WSGI_APPLICATION = 'demoapp.wsgi.application'
---
> REST_FRAMEWORK = {
>     # Use Django's standard `django.contrib.auth` permissions,
>     # or allow read-only access for unauthenticated users.
>     'DEFAULT_PERMISSION_CLASSES': [
>         'oauth2_provider.contrib.rest_framework.OAuth2Authentication',
>         'drf_social_oauth2.authentication.SocialAuthentication',
>     ]
> }
72a85,91
> AUTHENTICATION_BACKENDS = (
>     'social_core.backends.apple.AppleIdAuth',
>     'drf_social_oauth2.backends.DjangoOAuth2',
>     'django.contrib.auth.backends.ModelBackend',
> )
> 
> WSGI_APPLICATION = 'demoapp.wsgi.application'

Here's the diff between my changes to the urls.py file and the fresh install version:

17c17,18
< from django.urls import path
---
> from django.urls import path, include
> from django.conf.urls import url
20a22,23
>     path('api-auth/', include('rest_framework.urls')),
>     url(r'^auth/', include('drf_social_oauth2.urls', namespace='drf')),

Any suggestions for what could be wrong with my configuration? Please let me know if I can provide more information to help with debugging the issue.

@wagnerdelima
Copy link
Owner

@rodgutierrez what is the payload of your request?

@wagnerdelima wagnerdelima self-assigned this Dec 24, 2021
@wagnerdelima
Copy link
Owner

@rodgutierrez you are right. There is currently a bug on this endpoint. I would like to let you know that I am working on it. I will let you know as soon as I find something.

@wagnerdelima wagnerdelima added the bug Something isn't working label Dec 24, 2021
@wagnerdelima
Copy link
Owner

wagnerdelima commented Dec 24, 2021

@rodgutierrez

I believe I fixed the problem. I just released the newest version of the framework: https://pypi.org/project/drf-social-oauth2/1.1.3/.

You can check how I wrote this sample app for facebook authentication: https://github.com/wagnerdelima/facebook_setup.

Oh, and, happy xmas.

@rodgutierrez
Copy link
Author

@wagnerdelima sorry I missed your question a few days ago. I just tried the latest release and the disconnect-backend looks like it's working correctly now. 👍

merry christmas and happy new year to you too!

@rodgutierrez
Copy link
Author

@wagnerdelima i was poking around in the diff for the latest release just to see if there was anything else that i should test. I think that the complete/<str:backend>/endpoint may have a similar issue to the one i originally reported. let me know if you need any information from me.

@wagnerdelima
Copy link
Owner

Hi @rodgutierrez,

I will definitely check it out in the upcoming days.

Can you include here what specific endpoint and you trying and also the request payload? Thanks.

Thanks for reporting.

@rodgutierrez
Copy link
Author

hey @wagnerdelima, i'm trying the complete/apple-id/ endpoint. apple-id is the name of the backend that I'm using. at the moment i'm not sending anything in the request payload, but i would expect a different error if a missing payload was the problem. feel free to reach out if you need me to test anything.

here's a snippet of the error I'm seeing:

Exception Type: NoReverseMatch
Exception Value: 'social' is not a registered namespace

@wagnerdelima
Copy link
Owner

Reopening this for now.
@rodgutierrez I did not see your comment. Sorry for the huge delay.

@wagnerdelima wagnerdelima reopened this Apr 27, 2023
@hichem-dahi
Copy link

It's working for me. try adding in the settings.py file this line
SOCIAL_AUTH_URL_NAMESPACE = 'drf:social'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

3 participants