Modified code to verify login status before setting the value of shortApiCredentials variable.