Error when creating API key

When creating the API keys, it could happen that a key was not created correctly, which could cause issues with the Smart Client.