- Print
- DarkLight
- PDF
django-rocketchat-auth 1.2
- Print
- DarkLight
- PDF
Authenticate the users with Django Web Framework. This application implements the API used by QuickMeet.Chat IFrame authentication. Also, it handles logout by wiring up a method on Django signals.
Tested with Django 2.0.4 and QuickMeet.Chat 0.62.2. If you have any problems, please open an issue.
Configuration
Install this app in your project:
pip install django-rocketchat-authAdd
rocketchat_authto your INSTALLED_APPS setting like this:INSTALLED_APPS = ( ... 'rocketchat_auth', )Get a QuickMeet.Chat authentication token, so we can use the API.
Update the
settings.pyfile:MONGO_DB = 'localhost:27017' # or more verbose (e.g. for Heroku) # MONGO_DB = '<dbuser>:<dbpassword>@<dbhost>:<dbport>/<dbname>?authSource=<dbname>' ROCKETCHAT_URL = 'http://localhost:3000' ROCKETCHAT_AUTH_TOKEN = '<YOUR AUTH TOKEN FROM STEP 3>' ROCKETCHAT_USER_ID = '<YOUR USER ID>' CORS_ORIGIN_WHITELIST = ( 'localhost:8000', 'localhost:3000', )Include the
rocketchat_authURLconf in your projecturls.pyfile like this:urlpatterns += [url(r'^rocketchat/', include('rocketchat_auth.urls'))]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 and set your QuickMeet.Chat domain in CORS_ORIGIN_WHITELIST.
Configure Django's XFrameOptionsMiddleware to exempt your login page for QuickMeet.Chat requests or disable it (dangerous).
Configure Django's CsrfViewMiddleware to exempt your login page for QuickMeet.Chat requests or disable it (dangerous).
To access this settings, go to: Administration > 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. Please check the 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 QuickMeet.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 QuickMeet.Chat will use to submit information to the
API URL.