I am including the URLs in a manner similar to that in the docs, i.e. using path("auth/", include("drf_social_oauth2.urls", namespace="drf")). This results in the following URLs:
This, of course, necessitates that I put SOCIAL_AUTH_URL_NAMESPACE = "drf:social" in the Django settings, or else social_django's views will fail. I do not set DRFSO2_URL_NAMESPACE.
The problem
In SocialTokenGrant.validate_token_request(), which is used by ConvertTokenView, an attempt is made to reverse this URL:
DRFSO2_URL_NAMESPACE has its default value, which is "drf". NAMESPACE is the same as SOCIAL_AUTH_URL_NAMESPACE, i.e. "drf:social". The result is therefore that it tries to reverse the URL "drf:drf:social:complete", which obviously does not exist.
Possible solution
I guess the code above could simply be changed to:
"%s:complete" % (NAMESPACE,)
... but I haven't tested it or given it much thought.
A workaround
Explicitly including the social_django URLs, without namespacing them under "drf:", while also setting SOCIAL_AUTH_URL_NAMESPACE = "social", seems to be working. Of course, this results in "duplicate" URLs (the same URLs are registered in both the drf:social and the social namespaces) which is kind of ugly:
Setup
I am including the URLs in a manner similar to that in the docs, i.e. using
path("auth/", include("drf_social_oauth2.urls", namespace="drf"))
. This results in the following URLs:This, of course, necessitates that I put
SOCIAL_AUTH_URL_NAMESPACE = "drf:social"
in the Django settings, or else social_django's views will fail. I do not setDRFSO2_URL_NAMESPACE
.The problem
In
SocialTokenGrant.validate_token_request()
, which is used byConvertTokenView
, an attempt is made to reverse this URL:DRFSO2_URL_NAMESPACE
has its default value, which is"drf"
.NAMESPACE
is the same asSOCIAL_AUTH_URL_NAMESPACE
, i.e."drf:social"
. The result is therefore that it tries to reverse the URL"drf:drf:social:complete"
, which obviously does not exist.Possible solution
I guess the code above could simply be changed to:
... but I haven't tested it or given it much thought.
A workaround
Explicitly including the
social_django
URLs, without namespacing them under"drf:"
, while also settingSOCIAL_AUTH_URL_NAMESPACE = "social"
, seems to be working. Of course, this results in "duplicate" URLs (the same URLs are registered in both thedrf:social
and thesocial
namespaces) which is kind of ugly:Versions