--- title: "django-rocketchat-auth 1.2" slug: "django-rocketchat-auth-12" updated: 2026-01-08T09:29:27Z published: 2026-01-08T09:29:27Z canonical: "docs.rocket.chat/django-rocketchat-auth-12" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.rocket.chat/llms.txt > Use this file to discover all available pages before exploring further. # django-rocketchat-auth 1.2 Authenticate the users with Django Web Framework. This application implements the API used by Rocket.Chat IFrame authentication. Also, it handles logout by wiring up a method on Django signals. > [!NOTE] > Tested with Django 2.0.4 and Rocket.Chat 0.62.2. If you have any problems, please open an issue. ## Configuration 1. Install this app in your project: ```bash pip install django-rocketchat-auth ``` 2. Add `rocketchat_auth` to your INSTALLED_APPS setting like this: ```bash INSTALLED_APPS = (    ...    'rocketchat_auth', ) ``` 3. Get a [Rocket.Chat authentication token](/v1/docs/manage-your-account-settings#personal-access-tokens), so we can use the API. 4. Update the `settings.py` file: ```python MONGO_DB = 'localhost:27017' # or more verbose (e.g. for Heroku) # MONGO_DB = ':@:/?authSource=' ROCKETCHAT_URL = 'http://localhost:3000' ROCKETCHAT_AUTH_TOKEN = '' ROCKETCHAT_USER_ID = '' CORS_ORIGIN_WHITELIST = (    'localhost:8000',    'localhost:3000', ) ``` 5. Include the `rocketchat_auth` URLconf in your project `urls.py` file like this: ```python urlpatterns += [url(r'^rocketchat/', include('rocketchat_auth.urls'))] ``` 6. Since we will put your Django app into an iframe, we have to set up some security measures that would prevent it from happening. - Install [django-cors-headers](https://github.com/ottoyiu/django-cors-headers) and set your Rocket.Chat domain in CORS_ORIGIN_WHITELIST. - Configure Django's XFrameOptionsMiddleware to exempt your login page for Rocket.Chat requests or disable it (dangerous). - Configure Django's CsrfViewMiddleware to exempt your login page for Rocket.Chat requests or disable it (dangerous). 7. To access this setting, go to: **Manage** ![Screenshot 2025-12-23 130522.png](https://cdn.us.document360.io/6ae79a05-7252-45d0-96e8-8f375e07b1b2/Images/Documentation/Screenshot%202025-12-23%20130522.png) > **Workspace** > **Settings** > **Accounts** - **Enabled:** Enable this option to authenticate users using your own login page in place of the Rocket. Chat's login page via the iframe integration. Check the [Iframe integration](https://developer.rocket.chat/docs/customize-and-embed-iframe-integration) page for more information. - **Iframe URL**: Enter **** the URL (http://localhost:8000/login/?next=/rocketchat/redirect)of the page you want to show as the login page of your Rocket.Chat instance. - **API URL:** Enter the URL (http://localhost:8000/rocketchat/api), which refers to the endpoint on the third-party system. This will check if the user is already logged in to that system. - **API Method:** Specify the API (POST) method that Rocket.Chat will use to submit information to the `API URL.`