diff --git a/src/API/AbstractPluginActions.php b/src/API/AbstractPluginActions.php
index <HASH>..<HASH> 100644
--- a/src/API/AbstractPluginActions.php
+++ b/src/API/AbstractPluginActions.php
@@ -87,9 +87,6 @@ abstract class AbstractPluginActions
         $isCreated = $this->dataStore->createUserDataStore($requestBody['apiKey'], $requestBody['email'], null, null);
 
         if (!$isCreated) {
-            //remove bad credentials
-            $this->dataStore->createUserDataStore(null, null, null, null);
-
             return $this->api->createAPIError('Unable to save user credentials');
         }
 
@@ -97,6 +94,9 @@ abstract class AbstractPluginActions
         $testRequest = new Request('GET', 'user/', array(), array());
         $testResponse = $this->clientAPI->callAPI($testRequest);
         if (!$this->clientAPI->responseOk($testResponse)) {
+            //remove bad credentials
+            $this->dataStore->createUserDataStore(null, null, null, null);
+
             return $this->api->createAPIError('Email address or API key invalid.');
         }
PI-<I>: Only delete user credentials if APIKey/Email are bad.