diff --git a/lib/private/Authentication/Token/DefaultToken.php b/lib/private/Authentication/Token/DefaultToken.php
index 8e6774a0a22cdfd5eeafbbc21c86f772a577df8a..ecfb1a44f2e823dfc35b913ef115b1da5ca1e92d 100644
--- a/lib/private/Authentication/Token/DefaultToken.php
+++ b/lib/private/Authentication/Token/DefaultToken.php
@@ -122,8 +122,8 @@ class DefaultToken extends Entity implements IToken {
 		return [
 			'id' => $this->id,
 			'name' => $this->name,
-			'lastActivity' => $this->lastActivity,
-			'type' => $this->type,
+			'lastActivity' => (int)$this->lastActivity,
+			'type' => (int)$this->type,
 			'scope' => $this->getScopeAsArray()
 		];
 	}
diff --git a/tests/Settings/Controller/AuthSettingsControllerTest.php b/tests/Settings/Controller/AuthSettingsControllerTest.php
index f3ba2dd9167cfc7eee71b949b9654395c654ae34..339c698bcbb3ca30695d241720e84860731c8e04 100644
--- a/tests/Settings/Controller/AuthSettingsControllerTest.php
+++ b/tests/Settings/Controller/AuthSettingsControllerTest.php
@@ -94,8 +94,8 @@ class AuthSettingsControllerTest extends TestCase {
 			[
 				'id' => 100,
 				'name' => null,
-				'lastActivity' => null,
-				'type' => null,
+				'lastActivity' => 0,
+				'type' => 0,
 				'canDelete' => false,
 				'current' => true,
 				'scope' => ['filesystem' => true]
@@ -103,8 +103,8 @@ class AuthSettingsControllerTest extends TestCase {
 			[
 				'id' => 200,
 				'name' => null,
-				'lastActivity' => null,
-				'type' => null,
+				'lastActivity' => 0,
+				'type' => 0,
 				'canDelete' => true,
 				'scope' => ['filesystem' => true]
 			]