Skip to main content

Django LTI Authentication Made Easy. Easily integrate with your LTI provider for django projects

Project description Latest PyPI version

This project aims to provide a dead simple way to integrate LTI Authentication into your Django powered app. Try it now, and get rid of the complicated configuration of LTI.


  1. Set up the app as an LTI tool on Moodle. You need to specify the following:

    1. Secure Tool URL:
    Secure Tool URL
    1. Consumer key and Shared secret:
    Consumer Key and Secret
  2. Import the views module in your root

    # this is main for the project
    from django.conf.urls import url, include
    urlpatterns += [
           url(r'^lti/', include('django_lti_auth.urls')),
  3. In, add the LTI related configuration.

            "consumers": {
                "<djangoConsumerKey>": {
                    "secret": "<djangoSecret>"
                "valid_lti_request":"<Specify method to call after validation of a valid LTI payload>",
                "invalid_lti_request":"<Specify method to call after validation of an invalid LTI payload>"
            "next_url":"<Default home page>"
  4. You also need to add the following settings into your file.

  5. Add ‘django_lti_auth’ to INSTALLED_APPS



  • valid_lti_request - The module calls the method you specify here after validating the LTI payload if the payload is valid. The method passes the LTI payload values extracted into a python dictionary as an argument to this method. You can use this payload to bind the user variables to the session.

    def valid_lti_request(user_payload, request):
        request.session['userid'] = user_payload['user_id']
        request.session['roles'] =  user_payload['roles']
        request.session['context_id'] = user_payload['context_id']

    You can return a URL value in case you want to redirect the LTI authenticated user to a new URL after the LTI Authentication.

    def valid_lti_request(user_payload, request):
        url = reverse('<intented URL string>', kwargs={'context': user_payload['context_id'], 'userid':user_payload['user_id']})
        return url
  • invalid_lti_request - This method is called after validation when the LTI payload is invalid. You can use this method to redirect the user back to the login page (or an access denied page).


To install the package run the following command:

pip install django-lti-auth




MIT license


django_lti_auth was written by Rohit Jose.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_lti_auth-1.0.0.tar.gz (31.0 kB view hashes)

Uploaded source

Built Distribution

django_lti_auth-1.0.0-py2.py3-none-any.whl (5.6 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page