OpenEDX : Error 400 when using it as LTI provider
<p>I want to include some OpenEdx lesson on my web application. For this, I decided to use the LTI protocol which is supported by OpenEDX (as consumer and provider in last release). </p>

<p>My application, as LTI consumer, already integrate with success some contents from moodle LTI provider system.  </p>

<p>When I try to use the same code, everything works until i send via post all the parameter, openEDX respond me error 400 to my post request.</p>

<p>To make my test, I'm using the fullstack installation (Dogwood version) which i modify a bit to enable LTI provider functionnality according to : <a href="http://edx.readthedocs.org/projects/edx-installing-configuring-and-running/en/latest/configuration/lti/enable_lti.html" rel="nofollow">http://edx.readthedocs.org/projects/edx-installing-configuring-and-running/en/latest/configuration/lti/enable_lti.html</a></p>

<p>Then I follow documentation to configure LTI provider in administration interface, and an other page from official documentation to build my LTI call URL, which looks like : 
<a href="http://192.168.33.10/lti_provider/courses/course-v1:edX+DemoX+Demo_Course/block-v1:edX+DemoX+Demo_Course+type@vertical+block@vertical_0270f6de40fc" rel="nofollow">http://192.168.33.10/lti_provider/courses/course-v1:edX+DemoX+Demo_Course/block-v1:edX+DemoX+Demo_Course+type@vertical+block@vertical_0270f6de40fc</a></p>

<p>In my post request I send these parameters: </p>

<ul>
<li>user_id</li>
<li>lis_person_name_given</li>
<li>lis_person_name_family</li>
<li>lis_person_name_full</li>
<li>lis_person_contact_email_primary</li>
<li>resource_link_id</li>
<li>tool_consumer_instance_guid</li>
<li>endpoint_url</li>
<li>oauth_version</li>
<li>oauth_consumer_key</li>
<li>oauth_signature</li>
<li>oauth_signature_method</li>
<li>oauth_timestamp</li>
<li>oauth_nonce</li>
</ul>

<p>I already verify, all these parameter are properly send.</p>

<p>DO you have any idea where the error can come from?</p>

<p>Thanks a lot!</p>

<p>[EDIT :] I finally found where the trouble is. I miss some parameter which are only recommended in LTI bu mandatory in OpenEDX case.
If it miss a mandorty parameter, open edx return an error 400.</p>

<p>On /lms/djangoapps/lti_provider/views.py:</p>

<pre><code>REQUIRED_PARAMETERS = [
'roles', 'context_id', 'oauth_version', 'oauth_consumer_key',
'oauth_signature', 'oauth_signature_method', 'oauth_timestamp',
'oauth_nonce', 'user_id'
]

""" code which return error 400
params = get_required_parameters(request.POST)
if not params:
    return HttpResponseBadRequest()


def get_required_parameters(dictionary, additional_params=None):
"""
Extract all required LTI parameters from a dictionary and verify that none
are missing.
:param dictionary: The dictionary that should contain all required parameters
:param additional_params: Any expected parameters, beyond those required for
    the LTI launch.
:return: A new dictionary containing all the required parameters from the
    original dictionary and additional parameters, or None if any expected
    parameters are missing.
"""
    params = {}
    additional_params = additional_params or []
    for key in REQUIRED_PARAMETERS + additional_params:
        if key not in dictionary:
            return None
        params[key] = dictionary[key]
    return params
</code></pre>