Log and monitor Canvas access token requests that fail validation
- Dominant language
- Python
- Stars
- 53
- Forks
- 16
- Avg merge
- 14d 5h
- Merged PRs (30d)
- 14
Description
When a Canvas 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/canvas_api/_authenticated.py b/lms/services/canvas_api/_authenticated.py
index 241517f7..5dcb315f 100644
--- a/lms/services/canvas_api/_authenticated.py
+++ b/lms/services/canvas_api/_authenticated.py
@@ -80,7 +80,7 @@ class AuthenticatedClient:
# For documentation of this request see:
# https://canvas.instructure.com/doc/api/file.oauth_endpoints.html#post-login-oauth2-token
return self._send_token_request(
- grant_type="authorization_code",
+ grant_type="blah",
code=authorization_code,
redirect_uri=self._redirect_uri,
replace_tokens=True,
```
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.