diff --git a/apps/remoteStorage/lib_remoteStorage.php b/apps/remoteStorage/lib_remoteStorage.php
index 259efb0da690b02a12c7b8c26803fa366f01a114..5677ab3c6e0149d4b90becb885b71cd696207f55 100644
--- a/apps/remoteStorage/lib_remoteStorage.php
+++ b/apps/remoteStorage/lib_remoteStorage.php
@@ -3,7 +3,7 @@
 class OC_remoteStorage {
 	public static function getValidTokens($ownCloudUser, $userAddress, $dataScope) {
 		$query=OC_DB::prepare("SELECT token,appUrl FROM *PREFIX*authtoken WHERE user=? AND userAddress=? AND dataScope=? LIMIT 100");
-		$result=$query->execute(array($user,$userAddress,$dataScope));
+		$result=$query->execute(array($ownCloudUser,$userAddress,$dataScope));
 		if( PEAR::isError($result)) {
 			$entry = 'DB Error: "'.$result->getMessage().'"<br />';
 			$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';