diff --git a/src/Twig/PackagistExtension.php b/src/Twig/PackagistExtension.php
index 8ef8ade0..59031646 100644
--- a/src/Twig/PackagistExtension.php
+++ b/src/Twig/PackagistExtension.php
@@ -113,6 +113,9 @@ public function showApiTokenButton(UserInterface|string $token = null, bool $sho
if ($token instanceof User) {
$token = ($short ? ($token->getUserIdentifier() . ':') : '') . $token->getApiToken();
}
+ if ($token instanceof UserInterface) {
+ $token = '';
+ }
return $token ? '' . $token . '' : '';
}