iMerica / dj-rest-auth

Authentication for Django Rest Framework
https://dj-rest-auth.readthedocs.io/en/latest/index.html
MIT License
1.62k stars 302 forks source link

AttributeError: 'str' object has no attribute 'get' #603

Open gaxfor opened 3 months ago

gaxfor commented 3 months ago

Hi there,

I was trying the demo project ( https://dj-rest-auth.readthedocs.io/en/latest/demo.html ) and when I tried to login I got the error:

Django 4.2.5 django-allauth 0.61.1 dj-rest-auth 5.0.2 PyJWT 2.8.0

Internal Server Error: /api/v1/social/google/login/finish/ Traceback (most recent call last): File "/Users/junu/Documents/venv/ratatouille_web/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) File "/Users/junu/Documents/venv/ratatouille_web/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, callback_kwargs) File "/Users/junu/Documents/venv/ratatouille_web/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view return view_func(*args, *kwargs) File "/Users/junu/Documents/venv/ratatouille_web/lib/python3.9/site-packages/django/views/generic/base.py", line 104, in view return self.dispatch(request, args, kwargs) File "/Users/junu/Documents/venv/ratatouille_web/lib/python3.9/site-packages/django/utils/decorators.py", line 46, in _wrapper return bound_method(*args, kwargs) File "/Users/junu/Documents/venv/ratatouille_web/lib/python3.9/site-packages/django/views/decorators/debug.py", line 92, in sensitive_post_parameters_wrapper return view(request, *args, *kwargs) File "/Users/junu/Documents/venv/ratatouille_web/lib/python3.9/site-packages/dj_rest_auth/views.py", line 48, in dispatch return super().dispatch(args, kwargs) File "/Users/junu/Documents/venv/ratatouille_web/lib/python3.9/site-packages/rest_framework/views.py", line 509, in dispatch response = self.handle_exception(exc) File "/Users/junu/Documents/venv/ratatouille_web/lib/python3.9/site-packages/rest_framework/views.py", line 469, in handle_exception self.raise_uncaught_exception(exc) File "/Users/junu/Documents/venv/ratatouille_web/lib/python3.9/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception raise exc File "/Users/junu/Documents/venv/ratatouille_web/lib/python3.9/site-packages/rest_framework/views.py", line 506, in dispatch response = handler(request, *args, **kwargs) File "/Users/junu/Documents/venv/ratatouille_web/lib/python3.9/site-packages/dj_rest_auth/views.py", line 125, in post self.serializer.is_valid(raise_exception=True) File "/Users/junu/Documents/venv/ratatouille_web/lib/python3.9/site-packages/rest_framework/serializers.py", line 227, in is_valid self._validated_data = self.run_validation(self.initial_data) File "/Users/junu/Documents/venv/ratatouille_web/lib/python3.9/site-packages/rest_framework/serializers.py", line 429, in run_validation value = self.validate(value) File "/Users/junu/Documents/venv/ratatouille_web/lib/python3.9/site-packages/dj_rest_auth/registration/serializers.py", line 160, in validate login = self.get_social_login(adapter, app, social_token, token) File "/Users/junu/Documents/venv/ratatouille_web/lib/python3.9/site-packages/dj_rest_auth/registration/serializers.py", line 62, in get_social_login social_login = adapter.complete_login(request, app, token, response=response) File "/Users/junu/Documents/venv/ratatouille_web/lib/python3.9/site-packages/allauth/socialaccount/providers/google/views.py", line 82, in complete_login id_token = response.get("id_token") AttributeError: 'str' object has no attribute 'get'