Skip to content

Commit 8793aee

Browse files
committed
Fixed py3 compat problem:
py3 b64decode will raise binascii.Error when the decoding failed. To catch it, added new exception.
1 parent 23fb2a2 commit 8793aee

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

oauth2_provider/oauth2_validators.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import unicode_literals
22

33
import base64
4+
import binascii
45
import logging
56
from datetime import timedelta
67

@@ -56,7 +57,7 @@ def _authenticate_basic_auth(self, request):
5657

5758
try:
5859
b64_decoded = base64.b64decode(auth_string)
59-
except TypeError:
60+
except (TypeError, binascii.Error):
6061
log.debug("Failed basic auth: %s can't be decoded as base64", auth_string)
6162
return False
6263

0 commit comments

Comments
 (0)