Skip to content

Commit 8085886

Browse files
authored
Merge pull request #37 from johngian/27-raise-status
Raise error on OP 4xx/5xx responses
2 parents 98a1337 + 8c4f89a commit 8085886

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

mozilla_django_oidc/auth.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ def authenticate(self, code=None, state=None):
5757
response = requests.post(self.OIDC_OP_TOKEN_ENDPOINT,
5858
json=token_payload,
5959
verify=import_from_settings('VERIFY_SSL', True))
60+
response.raise_for_status()
61+
6062
# Validate the token
6163
token_response = response.json()
6264
payload = self.verify_token(token_response.get('id_token'))
@@ -67,6 +69,7 @@ def authenticate(self, code=None, state=None):
6769
})
6870
user_response = requests.get('{url}?{query}'.format(url=self.OIDC_OP_USER_ENDPOINT,
6971
query=query))
72+
user_response.raise_for_status()
7073
user_info = user_response.json()
7174

7275
try:

0 commit comments

Comments
 (0)