2

我正在关注 Facebook 的 django-rest-auth Social Authentication 安装指南,并根据安装指南将 FacebookLogin 类实现为 SocialLoginView 的子类,并将 adapter_class 设置为 FacebookOAuth2Adapter 适配器。

然后,当我向 /rest-auth/facebook 发布请求时,我收到以下错误消息“TypeError: init () missing 1 required positional argument: 'request'”来自 registration_serializers.py,第 63 行(adapter = adapter_class())

我错过了一个设置吗?也许是某个地方的alauth社交环境?谢谢

4

1 回答 1

4

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

解决方法是将初始化传递给适配器,我已经验证这适用于我的项目。

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

于 2016-04-06T22:00:22.037 回答