Connecting Moodle to LTI

@david David, would you please share a configuration instance with me? I tried many times for integrating Discourse with Moodle 3.10, but still no luck. Always said:

OpenSSL::PKey::RSAError (Neither PUB key nor PRIV key: nested asn1 error)
lib/middleware/omniauth_bypass_middleware.rb:50:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:355:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
lib/middleware/request_tracker.rb:187:in `call'

What have you entered in the “platform public key” setting? If I remember correctly, Moodle provides a JWKS url by default, which this plugin doesn’t support.

It should be possible to find the raw certificate somewhere, which you can copy/paste into Discourse,

@david Thank you for replying me. Yes. In Moodle. it showed Public keyset URL:
I opened this URL in browser, it showed as below:

    "keys": [
            "kty": "RSA",
            "alg": "RS256",
            "kid": "1371e22ce81f1dbb936a",
            "e": "AQAB",
            "n": "xXOfRS1UronVdVUEal0jyIhyNkAcbCRb6K2uzLsoQgRAaqA2ixbshCTWW_Yj-ZoJgg7UoruO65TB5EIldMyPJbYjYoMF0rB5a-wcvEhtWxfLs8FsDNLM9czjYXZUXBJ6sxIGNp-9Wp4c6PaecvXDfc4bJoHU8Ee5WzUk2XuX8dXX4jx8ipwzRa8qaQT-0cIPnZw4LmkPiTgn-gA-LuqjG2w9awwjnWTuZbTNPTphgPO9FD4lD_dAY3biURU_lEyJXflqFYwbrpja-b8y23qixwiHEYsM3_2F5D-DrI3Nsty219-ALDmJ0wY1hnr4p2NfwYZr_d2YjpIiJW_8iW3SRQ",
            "use": "sig"

I copied the value of “n” in the json (the longest one) into Discourse. But still the same error.

I don’t think copying the n value will be enough - discourse needs the key in the PEM format. Long-term we might be able to add support for JWKs, but in the short term you should be able to get it working by converting the key.

There are some online tools which can convert from JWKs format into PEM. Here’s one. (Obviously I can’t guarantee the safety of these online tools, so make sure you only paste public information into them)

Once you have the PEM (starting with -----BEGIN PUBLIC KEY-----, then Discourse should accept it.