If you run your own server and have noticed 500 errors when attempting to use OAuth authentication, there are some steps you need to take manually due to a change in the django-oauth-toolkit library that we use.
The steps are:
- Enter your KoBoCAT container (or, better yet, start a one-off container);
- Downgrade django-oauth-toolkit from version 1.3.2 to version 1.2.0;
- Run the Django
manage.py migrate
command; - Upgrade django-oauth-toolkit to 1.3.2;
- Re-run the
manage.py migrate
command.
Specifically, if you’re using kobo-install:
- In your
kobo-install
directory, execute./run.py -cf run --rm kobocat bash
, which will start a one-off KoBoCAT container; - Now, inside that one-off container, execute
pip install django-oauth-toolkit==1.2.0
; - Now that django-oauth-toolkit has been downgraded, execute
./manage.py migrate
;
- It’s okay if you see
Your models have changes that are not yet reflected in a migration, and so won't be applied
. You do not need to take any action.
- Upgrade the library back to the 1.3.2 version with
pip install django-oauth-toolkit==1.3.2
; - Run
./manage.py migrate
.
- It’s fine if no migrations are applied in this step, and, again, you can ignore the message
Your models have changes that are not yet reflected in a migration…
.
If you have trouble with this procedure, please reply here. This is only needed if you use OAuth for integration with external applications. If you don’t know what that is, don’t worry about it!
For search purposes, some common exceptions raised due to this problem are:
psycopg2.errors.UndefinedColumn: column oauth2_provider_application.created does not exist
psycopg2.errors.UndefinedColumn: column oauth2_provider_accesstoken.source_refresh_token_id does not exist
psycopg2.ProgrammingError: column "source_refresh_token_id" of relation "oauth2_provider_accesstoken" does not exist