necaris / python3-openid

Python 3 port of the python-openid library
Apache License 2.0
46 stars 42 forks source link

binascii.Error: Incorrect padding #40

Open mw66 opened 5 years ago

mw66 commented 5 years ago

Try to login with Yahoo

test env: python3.6 django==2.1.5 python3-openid version_info = (3, 1, 0)

binascii.Error: Incorrect padding

Internal Server Error: /accounts/openid/login/ Traceback (most recent call last): File "/home//project//src/mypy/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "/home//project//src/mypy/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response response = self.process_exception_by_middleware(e, request) File "/home//project//src/mypy/lib/python3.6/site-packages/django/core/handlers/base.py", line 124, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/home//project//src/mypy/lib/python3.6/site-packages/allauth/socialaccount/providers/openid/views.py", line 43, in login auth_request = client.begin(form.cleaned_data['openid']) File "/home//project//src/mypy/lib/python3.6/site-packages/openid/consumer/consumer.py", line 359, in begin return self.beginWithoutDiscovery(service, anonymous) File "/home//project//src/mypy/lib/python3.6/site-packages/openid/consumer/consumer.py", line 382, in beginWithoutDiscovery auth_req = self.consumer.begin(service) File "/home//project//src/mypy/lib/python3.6/site-packages/openid/consumer/consumer.py", line 610, in begin assoc = self._getAssociation(service_endpoint) File "/home//project//src/mypy/lib/python3.6/site-packages/openid/consumer/consumer.py", line 1178, in _getAssociation assoc = self.store.getAssociation(endpoint.server_url) File "/home//project//src/mypy/lib/python3.6/site-packages/allauth/socialaccount/providers/openid/utils.py", line 104, in getAssociation base64.decodestring(stored_assoc.secret.encode('utf-8')), File "/home//project//src/mypy/lib/python3.6/base64.py", line 554, in decodestring return decodebytes(s) File "/home//project//src/mypy/lib/python3.6/base64.py", line 546, in decodebytes return binascii.a2b_base64(s) binascii.Error: Incorrect padding [2019-01-15 00:37:41,282 log.py:228 - log_response()] Internal Server Error: /accounts/openid/login/

mw66 commented 5 years ago

https://github.com/python-social-auth/social-core/issues/180

necaris commented 4 years ago

@mingwugmail are you still facing this issue? I'm not using python-social-auth myself, but looking at the django-allauth code that interfaces with this -- it looks like the secret value that's being decoded here is stored elsewhere in the same module by this method. So it may be up to that code to validate the value that's being stored?