diff --git a/models/MatrixAccount.php b/models/MatrixAccount.php
index 276f186efd331c1d31b689c69007d5f67b882571..9e75d29d3383b9971adf8e160525388ce81c7a5f 100644
--- a/models/MatrixAccount.php
+++ b/models/MatrixAccount.php
@@ -63,6 +63,8 @@ class MatrixAccount extends SimpleORMap
             // Access token specified, use this (and skip login because the token can be used directly).
             if (trim(Config::get()->MATRIX_SYSTEM_ACCOUNT_ACCESS_TOKEN) != '') {
                 $account = new Patrix\Account(trim(Config::get()->MATRIX_SYSTEM_ACCOUNT_USERNAME), '');
+                $account->setUserId(
+                    '@' . Config::get()->MATRIX_SYSTEM_ACCOUNT_USERNAME . ':' . MATRIX_ACCOUNTS_LOCAL_PART);
                 $account->setAccessData(trim(Config::get()->MATRIX_SYSTEM_ACCOUNT_ACCESS_TOKEN), 'Stud.IP');
             // No token, login by username and password.
             } else {