Keep getting "Authentication Failed" message when trying to upload to app store using altool

I keep getting the "Authentication Failed" message when trying to upload to the app store using altool. The command that I am using is:

xcrun altool --upload-app --type ios -f path/to/file --apiKey $key --apiIssuer $id

This is the error message that I get:


    "Error Domain=ITunesConnectionAuthenticationErrorDomain Code=-26000 \"Failure to authenticate.\" UserInfo={NSLocalizedRecoverySuggestion=Failure to authenticate., NSLocalizedDescription=Failure to authenticate., NSLocalizedFailureReason=App Store operation failed.}"

) (-1011)

 {

    NSLocalizedDescription = "Unable to upload archive.";

    NSLocalizedFailureReason = "Failed to authenticate for session: (\n    \"Error Domain=ITunesConnectionAuthenticationErrorDomain Code=-26000 \\\"Failure to authenticate.\\\" UserInfo={NSLocalizedRecoverySuggestion=Failure to authenticate., NSLocalizedDescription=Failure to authenticate., NSLocalizedFailureReason=App Store operation failed.}\"\n)";

}

I have tried --list-providers and it gives me the name of the account associated with the api key. Is there another step that I am missing after creating the apiKey?

Keep getting "Authentication Failed" message when trying to upload to app store using altool
 
 
Q