python-social-auth/social-core

When Kakao login is linked with the distributed social login library, the integration fails.

search5 opened this issue · 0 comments

Expected behaviour

If you use Kakao as the social backend, and you do not set anything as a consent item for collection information in Kakao login, you must log in to Kakao.

Actual behaviour

Login was performed in Kakao, but AttributeError: 'str' object has no attribute 'get' occurs at line 26 of social-core/backends/kakao.py, and Interval Server Error is displayed in the browser.

What are the steps to reproduce this issue?

Input clear steps to reproduce the issue for a maintainer.

  1. Kakao developer site registration (https://developers.kakao.com)
  2. Kakao application registration (Platform registration, Kakao Login activation, Client Secret creation and activation, Redirect URI registration)
  3. Test social login app by adding SOCIAL_AUTH_KAKAO_KEY (REST API key from Kakao application app key page), SOCIAL_AUTH_KAKAO_SECRET to settings.py

Any logs, error output, etc?

The following error message is output. The detailed route may be slightly different.

Traceback (most recent call last):
  File "/home/jiho/.virtualenvs/flask2nd/lib/python3.9/site-packages/flask/app.py", line 2077, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/jiho/.virtualenvs/flask2nd/lib/python3.9/site-packages/flask/app.py", line 1525, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/jiho/.virtualenvs/flask2nd/lib/python3.9/site-packages/flask/app.py", line 1523, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/jiho/.virtualenvs/flask2nd/lib/python3.9/site-packages/flask/app.py", line 1509, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/home/jiho/.virtualenvs/flask2nd/lib/python3.9/site-packages/social_flask/utils.py", line 43, in wrapper
    return func(backend, *args, **kwargs)
  File "/home/jiho/.virtualenvs/flask2nd/lib/python3.9/site-packages/social_flask/routes.py", line 22, in complete
    return do_complete(g.backend, login=do_login, user=g.user,
  File "/home/jiho/.virtualenvs/flask2nd/lib/python3.9/site-packages/social_core/actions.py", line 45, in do_complete
    user = backend.complete(user=user, *args, **kwargs)
  File "/home/jiho/.virtualenvs/flask2nd/lib/python3.9/site-packages/social_core/backends/base.py", line 40, in complete
    return self.auth_complete(*args, **kwargs)
  File "/home/jiho/.virtualenvs/flask2nd/lib/python3.9/site-packages/social_core/utils.py", line 247, in wrapper
    return func(*args, **kwargs)
  File "/home/jiho/.virtualenvs/flask2nd/lib/python3.9/site-packages/social_core/backends/oauth.py", line 391, in auth_complete
    return self.do_auth(response['access_token'], response=response,
  File "/home/jiho/.virtualenvs/flask2nd/lib/python3.9/site-packages/social_core/utils.py", line 247, in wrapper
    return func(*args, **kwargs)
  File "/home/jiho/.virtualenvs/flask2nd/lib/python3.9/site-packages/social_core/backends/oauth.py", line 403, in do_auth
    return self.strategy.authenticate(*args, **kwargs)
  File "/home/jiho/.virtualenvs/flask2nd/lib/python3.9/site-packages/social_core/strategy.py", line 163, in authenticate
    return backend.authenticate(*args, **kwargs)
  File "/home/jiho/.virtualenvs/flask2nd/lib/python3.9/site-packages/social_core/backends/base.py", line 80, in authenticate
    return self.pipeline(pipeline, *args, **kwargs)
  File "/home/jiho/.virtualenvs/flask2nd/lib/python3.9/site-packages/social_core/backends/base.py", line 83, in pipeline
    out = self.run_pipeline(pipeline, pipeline_index, *args, **kwargs)
  File "/home/jiho/.virtualenvs/flask2nd/lib/python3.9/site-packages/social_core/backends/base.py", line 113, in run_pipeline
    result = func(*args, **out) or {}
  File "/home/jiho/.virtualenvs/flask2nd/lib/python3.9/site-packages/social_core/pipeline/social_auth.py", line 5, in social_details
    return {'details': dict(backend.get_user_details(response), **details)}
  File "/home/jiho/.virtualenvs/flask2nd/lib/python3.9/site-packages/social_core/backends/kakao.py", line 26, in get_user_details
    kaccount_email = kakao_account.get('email', '')
AttributeError: 'str' object has no attribute 'get'

Any other comments?

We will PR the code that fixed this problem.