diff --git a/lib/private/Authentication/Login/CreateSessionTokenCommand.php b/lib/private/Authentication/Login/CreateSessionTokenCommand.php
index 14ad6d18b302c585aa8e251b1a6fc191707d6e38..59d5c68a24bfee160949b5633dc164da399543c2 100644
--- a/lib/private/Authentication/Login/CreateSessionTokenCommand.php
+++ b/lib/private/Authentication/Login/CreateSessionTokenCommand.php
@@ -59,7 +59,7 @@ class CreateSessionTokenCommand extends ALoginCommand {
 		);
 		$this->userSession->updateTokens(
 			$loginData->getUser()->getUID(),
-			$loginData->getUsername()
+			$loginData->getPassword()
 		);
 
 		return $this->processNextOrFinishSuccessfully($loginData);
diff --git a/tests/lib/Authentication/Login/CreateSessionTokenCommandTest.php b/tests/lib/Authentication/Login/CreateSessionTokenCommandTest.php
index 136906f42b050a1f00d44346143c97b6e5333b45..11d2ea36b27efd6d475a59fbdf4efee41afd759b 100644
--- a/tests/lib/Authentication/Login/CreateSessionTokenCommandTest.php
+++ b/tests/lib/Authentication/Login/CreateSessionTokenCommandTest.php
@@ -76,7 +76,7 @@ class CreateSessionTokenCommandTest extends ALoginCommandTest {
 			->method('updateTokens')
 			->with(
 				$this->username,
-				$this->username
+				$this->password
 			);
 
 		$result = $this->cmd->process($data);
@@ -109,7 +109,7 @@ class CreateSessionTokenCommandTest extends ALoginCommandTest {
 			->method('updateTokens')
 			->with(
 				$this->username,
-				$this->username
+				$this->password
 			);
 
 		$result = $this->cmd->process($data);