Using python 3.55 and django 1.10 in my Oauth2 flow (with 
django_openid_auth in my installed apps),
my code executes without any errors. But in a python 3.55 and django >=2.0 
environment, I get the following error:

Error at /openid/login/

Incorrect padding


I've spent two days searching for what's causing this and haven't found 
anything. There is some discussion here:
https://github.com/WeblateOrg/weblate/issues/1799
and here:
https://bugs.python.org/issue33770

But, I haven't found a solution. Does anyone know the reason why this is 
happening or have a solution?


Here's my traceback:
Internal Server Error: /openid/login/
Traceback (most recent call last):
  File 
"/home/malcolm/anaconda3/envs/qb6/lib/python3.5/site-packages/django/core/handlers/exception.py",
 
line 35, in inner
    response = get_response(request)
  File 
"/home/malcolm/anaconda3/envs/qb6/lib/python3.5/site-packages/django/core/handlers/base.py",
 
line 128, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File 
"/home/malcolm/anaconda3/envs/qb6/lib/python3.5/site-packages/django/core/handlers/base.py",
 
line 126, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/malcolm/qb6/qb5/django_openid_auth/views.py", line 191, in 
login_begin
    openid_request = consumer.begin(openid_url)
  File 
"/home/malcolm/anaconda3/envs/qb6/lib/python3.5/site-packages/openid/consumer/consumer.py",
 
line 359, in begin
    return self.beginWithoutDiscovery(service, anonymous)
  File 
"/home/malcolm/anaconda3/envs/qb6/lib/python3.5/site-packages/openid/consumer/consumer.py",
 
line 382, in beginWithoutDiscovery
    auth_req = self.consumer.begin(service)
  File 
"/home/malcolm/anaconda3/envs/qb6/lib/python3.5/site-packages/openid/consumer/consumer.py",
 
line 610, in begin
    assoc = self._getAssociation(service_endpoint)
  File 
"/home/malcolm/anaconda3/envs/qb6/lib/python3.5/site-packages/openid/consumer/consumer.py",
 
line 1178, in _getAssociation
    assoc = self.store.getAssociation(endpoint.server_url)
  File "/home/malcolm/qb6/qb5/django_openid_auth/store.py", line 80, in 
getAssociation
    base64.decodestring(assoc.secret.encode('utf-8')),
  File "/home/malcolm/anaconda3/envs/qb6/lib/python3.5/base64.py", line 
562, in decodestring
    return decodebytes(s)
  File "/home/malcolm/anaconda3/envs/qb6/lib/python3.5/base64.py", line 
554, in decodebytes
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding
ERROR:django.request:Internal Server Error: /openid/login/
Traceback (most recent call last):
  File 
"/home/malcolm/anaconda3/envs/qb6/lib/python3.5/site-packages/django/core/handlers/exception.py",
 
line 35, in inner
    response = get_response(request)
  File 
"/home/malcolm/anaconda3/envs/qb6/lib/python3.5/site-packages/django/core/handlers/base.py",
 
line 128, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File 
"/home/malcolm/anaconda3/envs/qb6/lib/python3.5/site-packages/django/core/handlers/base.py",
 
line 126, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/malcolm/qb6/qb5/django_openid_auth/views.py", line 191, in 
login_begin
    openid_request = consumer.begin(openid_url)
  File 
"/home/malcolm/anaconda3/envs/qb6/lib/python3.5/site-packages/openid/consumer/consumer.py",
 
line 359, in begin
    return self.beginWithoutDiscovery(service, anonymous)
  File 
"/home/malcolm/anaconda3/envs/qb6/lib/python3.5/site-packages/openid/consumer/consumer.py",
 
line 382, in beginWithoutDiscovery
    auth_req = self.consumer.begin(service)
  File 
"/home/malcolm/anaconda3/envs/qb6/lib/python3.5/site-packages/openid/consumer/consumer.py",
 
line 610, in begin
    assoc = self._getAssociation(service_endpoint)
  File 
"/home/malcolm/anaconda3/envs/qb6/lib/python3.5/site-packages/openid/consumer/consumer.py",
 
line 1178, in _getAssociation
    assoc = self.store.getAssociation(endpoint.server_url)
  File "/home/malcolm/qb6/qb5/django_openid_auth/store.py", line 80, in 
getAssociation
    base64.decodestring(assoc.secret.encode('utf-8')),
  File "/home/malcolm/anaconda3/envs/qb6/lib/python3.5/base64.py", line 
562, in decodestring
    return decodebytes(s)
  File "/home/malcolm/anaconda3/envs/qb6/lib/python3.5/base64.py", line 
554, in decodebytes
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding
[11/Jun/2018 01:44:19] "GET 
/openid/login/?next=/quick/authCodeHandler%3Fstate%3Da2tbp1iauv66p9o8pnndhjfmy6fc8njotrgkppbx%26code%3DL011528681818rdMG5DmLYzdLfwvyaRcHY02PaWYoxkoxEP2w4%26realmId%3D123145812832527
 
HTTP/1.1" 500 150348


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/67a4a398-7f63-4a41-a9c9-272afd99198a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to