-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: JWK must contain a "kty" parameter" #53
Comments
hi @disazoz . How did you set Public Key on the Moodle side?
As you may see all items contain required |
Thanks for the reply. On the Moodle side I use Keyset URL option and put JWKS URL from PyLTI. Yes, I see, that PyLTI has kty in JWKS. I just checked setup with manual RSA key on moodle side, and at least there are no 127.0.0.1 - - [20/Oct/2021 02:51:19] "POST /api/score/lti1p3-launch-43cfd02d-e1f7-46f3-b0e3-02eefd4d53fa/2/13/ HTTP/1.1" 500 - |
@disazoz it looks like Moodle issue. Check error details there |
I have this issue too. The problem is that the flask demo app is returning the keys in a 'keys' object in the /jwks endpoint rather than directly. The fix to game.py is is
|
I also tried to get the flask example project to work with Moodle the first error that I ran into had Moodle complain about something along the lines of (googled it because I can't reproduce it now without a fresh Moodle)
That one was resolved by what @hmoffatt wrote above (thanks). i made a PR with that change (dmitry-viskov/pylti1.3-flask-example#14) in the flask example repo. I also ran into that
that happened only on that same POST request, and for me that was caused by using the admin account to test. Once I switched to a student account for testing that error went away. |
Hello team,
|
Wrong URL? Do you see your JWKs endpoint being called? I am using Moodle 4.0 latest and don't have any issue. |
Thanks for the reply hmoffatt, I know that it is working for you because I have read the Issues. |
Hi hmoffatt, |
I've updated my Moodle to 4.1 and it's still working ok for me. You can find my Twitter account on my github profile and send me a DM there, I don't think there is a way to DM directly on github. |
@mgarefal Hi there, did you fix this error? The same error occurred to me too. When I used public key instead of keyset url, I have got "status": 401,"reason": "Unauthorized". |
@hmoffatt @dmitry-viskov Hello there, I am getting the same error. I have deployed Moodle on a public ip address. When I used public key instead of keyset url, I have got "status": 401,"reason": "Unauthorized". |
Tying to run flask example tool in Moodle. The game loaded successfully, and when JS trying get a score from Moodle, got this error.
127.0.0.1 - - [14/Oct/2021 03:20:09] "GET /api/scoreboard/lti1p3-launch-adcbe674-c539-46d7-bd71-a88fa3d41a6e/ HTTP/1.1" 500 -
Traceback (most recent call last):
File "C:\Users\disazoz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 2464, in call
return self.wsgi_app(environ, start_response)
File "c:\Users\disazoz\Desktop\test\pylti1.3-flask-example\game\app.py", line 26, in call
return self.app(environ, start_response)
File "C:\Users\disazoz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 2450, in wsgi_app
response = self.handle_exception(e)
File "C:\Users\disazoz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1867, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\disazoz\AppData\Roaming\Python\Python37\site-packages\flask_compat.py", line 39, in reraise
raise value
File "C:\Users\disazoz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\disazoz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\disazoz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\disazoz\AppData\Roaming\Python\Python37\site-packages\flask_compat.py", line 39, in reraise
raise value
File "C:\Users\disazoz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\disazoz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1936, in dispatch_request
return self.view_functionsrule.endpoint
File "c:\Users\disazoz\Desktop\test\pylti1.3-flask-example\game\app.py", line 222, in scoreboard
scores = ags.get_grades(score_line_item)
File "C:\Programs\WPy64-3771\python-3.7.7.amd64\lib\site-packages\pylti1p3\assignments_grades.py", line 200, in get_grades
lineitem = self.find_or_create_lineitem(lineitem, find_by=find_by)
File "C:\Programs\WPy64-3771\python-3.7.7.amd64\lib\site-packages\pylti1p3\assignments_grades.py", line 157, in find_or_create_lineitem
lineitem = self.find_lineitem_by_tag(tag)
File "C:\Programs\WPy64-3771\python-3.7.7.amd64\lib\site-packages\pylti1p3\assignments_grades.py", line 142, in find_lineitem_by_tag
return self.find_lineitem('tag', tag)
File "C:\Programs\WPy64-3771\python-3.7.7.amd64\lib\site-packages\pylti1p3\assignments_grades.py", line 117, in find_lineitem
lineitems, lineitems_url = self.get_lineitems_page(lineitems_url)
File "C:\Programs\WPy64-3771\python-3.7.7.amd64\lib\site-packages\pylti1p3\assignments_grades.py", line 83, in get_lineitems_page
accept='application/vnd.ims.lis.v2.lineitemcontainer+json'
File "C:\Programs\WPy64-3771\python-3.7.7.amd64\lib\site-packages\pylti1p3\service_connector.py", line 110, in make_service_request
access_token = self.get_access_token(scopes)
File "C:\Programs\WPy64-3771\python-3.7.7.amd64\lib\site-packages\pylti1p3\service_connector.py", line 87, in get_access_token
raise LtiServiceException(r)
pylti1p3.exception.LtiServiceException: HTTP response [https://learn.qweasd.su/mod/lti/token.php]: 400 - {
"error" : "JWK must contain a "kty" parameter"
}
Not sure if it related, but i'm using private and public keys that were in the example git repo. The Moodle platform just self hosted instance.
The text was updated successfully, but these errors were encountered: