We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm using django-allauth==0.52.0 with dj-rest-auth==2.2.5.
django-allauth==0.52.0
dj-rest-auth==2.2.5
When I switched from react-google-login to @react-oauth/google on the frontend, I started getting this error:
react-google-login
@react-oauth/google
172.18.0.1 - - [16/Mar/2023 11:50:10] "POST /rest-auth/google/ HTTP/1.1" 500 - Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/django/contrib/staticfiles/handlers.py", line 80, in __call__ return self.application(environ, start_response) File "/usr/local/lib/python3.10/site-packages/django/core/handlers/wsgi.py", line 132, in __call__ response = self.get_response(request) File "/usr/local/lib/python3.10/site-packages/django/core/handlers/base.py", line 140, in get_response response = self._middleware_chain(request) File "/usr/local/lib/python3.10/site-packages/django/core/handlers/exception.py", line 57, in inner response = response_for_exception(request, exc) File "/usr/local/lib/python3.10/site-packages/django/core/handlers/exception.py", line 139, in response_for_exception response = handle_uncaught_exception( File "/usr/local/lib/python3.10/site-packages/django/core/handlers/exception.py", line 180, in handle_uncaught_exception return debug.technical_500_response(request, *exc_info) File "/usr/local/lib/python3.10/site-packages/django_extensions/management/technical_response.py", line 40, in null_technical_500_response raise exc_value.with_traceback(tb) File "/usr/local/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) File "/usr/local/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/local/lib/python3.10/contextlib.py", line 79, in inner return func(*args, **kwds) File "/usr/local/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view return view_func(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/django/views/generic/base.py", line 84, in view return self.dispatch(request, *args, **kwargs) File "/usr/local/lib/python3.10/site-packages/django/utils/decorators.py", line 46, in _wrapper return bound_method(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/django/views/decorators/debug.py", line 92, in sensitive_post_parameters_wrapper return view(request, *args, **kwargs) File "/usr/local/lib/python3.10/site-packages/dj_rest_auth/views.py", line 53, in dispatch return super().dispatch(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/rest_framework/views.py", line 509, in dispatch response = self.handle_exception(exc) File "/usr/local/lib/python3.10/site-packages/rest_framework/views.py", line 469, in handle_exception self.raise_uncaught_exception(exc) File "/usr/local/lib/python3.10/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception raise exc File "/usr/local/lib/python3.10/site-packages/rest_framework/views.py", line 506, in dispatch response = handler(request, *args, **kwargs) File "/usr/local/lib/python3.10/site-packages/dj_rest_auth/views.py", line 130, in post self.serializer.is_valid(raise_exception=True) File "/usr/local/lib/python3.10/site-packages/rest_framework/serializers.py", line 227, in is_valid self._validated_data = self.run_validation(self.initial_data) File "/usr/local/lib/python3.10/site-packages/rest_framework/serializers.py", line 429, in run_validation value = self.validate(value) File "/usr/local/lib/python3.10/site-packages/dj_rest_auth/registration/serializers.py", line 150, in validate login = self.get_social_login(adapter, app, social_token, token) File "/usr/local/lib/python3.10/site-packages/dj_rest_auth/registration/serializers.py", line 60, in get_social_login social_login = adapter.complete_login(request, app, token, response=response) File "/usr/local/lib/python3.10/site-packages/allauth/socialaccount/providers/google/views.py", line 22, in complete_login response["id_token"], TypeError: string indices must be integers
It happens because the response here is a string containing a JWT token.
response
I managed to work around this by overriding the adapter's complete_login method:
complete_login
class GoogleIdentityServiceOAuth2Adapter(GoogleOAuth2Adapter): def complete_login(self, request, app, token, response, **kwargs): return super().complete_login(request, app, token, {"id_token": response}, **kwargs)
The text was updated successfully, but these errors were encountered:
This was previously reported and is a dj-rest-auth bug: #3228 (comment)
dj-rest-auth
Sorry, something went wrong.
Closing -- not an issue in alauth
No branches or pull requests
I'm using
django-allauth==0.52.0
withdj-rest-auth==2.2.5
.When I switched from
react-google-login
to@react-oauth/google
on the frontend, I started getting this error:It happens because the
response
here is a string containing a JWT token.I managed to work around this by overriding the adapter's
complete_login
method:The text was updated successfully, but these errors were encountered: