hypothesis / hypothesis/lms

Log and monitor Blackboard access token requests that fail validation

Open
#3,323 0 comments 0 reactions 1 assignee Claimed by @seanh View on GitHub
Backend
Dominant language
Python
Stars
53
Forks
16
Avg merge
14d 5h
Merged PRs (30d)
14

Description

When a Blackboard access token request fails we should show the failed request, response and validation errors:

- [ ] In the error dialog (that's shown in the authorization popup window)
- [ ] In the logs (Papertrail)
- [ ] In Sentry

This should work when the access token request fails:

```diff
diff --git a/lms/services/oauth_http.py b/lms/services/oauth_http.py
index 6f05a699..7b198a52 100644
--- a/lms/services/oauth_http.py
+++ b/lms/services/oauth_http.py
@@ -72,7 +72,7 @@ class OAuthHTTPService:
auth=auth,
data={
"redirect_uri": redirect_uri,
- "grant_type": "authorization_code",
+ "grant_type": "foo",
"code": authorization_code,
},
)
```

And also when the access token response is invalid:

```diff
diff --git a/lms/validation/authentication/_oauth.py b/lms/validation/authentication/_oauth.py
index 54acce6d..f3a69ff3 100644
--- a/lms/validation/authentication/_oauth.py
+++ b/lms/validation/authentication/_oauth.py
@@ -137,6 +137,7 @@ class OAuthTokenResponseSchema(RequestsResponseSchema):
"""Schema for token responses from OAuth 2 authentication servers."""

access_token = fields.Str(required=True)
+ foo = fields.Str(required=True)
refresh_token = fields.Str()
expires_in = fields.Integer()

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.