django rest auth - FacebookLogin 视图,缺少 1 个必需的位置参数 'request'

django rest auth - FacebookLogin view, missing 1 required positional argument 'request'

我正在关注 Facebook 的 django-rest-auth 社交身份验证安装指南,并将 FacebookLogin class 作为 SocialLoginView 的子 class 实现,并设置了 adapter_class根据安装指南添加到 FacebookOAuth2Adapter 适配器。

当我然后 post 向 /rest-auth/facebook 发出请求时,我从 registration_serializers.py 的第 63 行(适配器 = adapter_class( ))

我是否缺少设置?也许某处是 allauth 社交环境?谢谢

这是 django-rest-auth 和 django-allauth > 0.25 的错误。

解决方法是将 init 传递到适配器中,我已经验证这适用于我的项目。

class FacebookOAuth2AdapterCustom(FacebookOAuth2Adapter):
    def __init__(self):
        pass

class FacebookLogin(SocialLoginView):
    adapter_class = FacebookOAuth2AdapterCustom

已提交 django-rest-auth 问题:https://github.com/Tivix/django-rest-auth/issues/197