diff --git a/lib/IdPAccountManager/WebRequest.pm b/lib/IdPAccountManager/WebRequest.pm
index 558562ad1c38cb77243068a0ef1b539c27628395..c828e80d4dd7fbd9d633ba561c3c6484346195f6 100644
--- a/lib/IdPAccountManager/WebRequest.pm
+++ b/lib/IdPAccountManager/WebRequest.pm
@@ -11,6 +11,7 @@ use Log::Any::Adapter;
 use List::MoreUtils qw(uniq);
 
 use IdPAccountManager::TestAccount;
+use IdPAccountManager::TestAccount::Manager;
 use IdPAccountManager::AuthenticationToken;
 use IdPAccountManager::ServiceProvider;
 use IdPAccountManager::SAMLMetadata;
@@ -493,11 +494,15 @@ sub req_validate_token {
     }
 
     ## Update simpleSAMLphp configuration to enable test accounts
+    my $accounts = IdPAccountManager::TestAccount::Manager->get_testaccounts(
+        db => $self->{db}
+    );
+
     eval {
         IdPAccountManager::Tools::update_ssp_authsources(
             $self->{configuration}->{_}->{templates_dir},
             $self->{configuration}->{idp}->{accounts_file},
-            \@accounts,
+            $accounts
         );
     };
     if ($EVAL_ERROR) {