Error: HTTP status code: 401. Unable to authenticate. The application is not allowed for primary authentication. Ensure that all authentication arguments are correct.

Previously, we did Notarization with the help of altool, but it has now been decommissioned by Apple. We need to use the Notary tool for Notarization.
My application is not on App-store.So I tried storing credentials in the keychain, but encountered an error after providing all the details, including appleid, app-specific password, and teamid. it is showing this below error. Error: HTTP status code: 401. Unable to authenticate. The application is not allowed for primary authentication. Ensure that all authentication arguments are correct.
 We created app- specific password using the same Apple ID account which also has the certificates with which we are trying to Notarize our application.

Initially, we were not able to access this Apple ID account because the employee that created this account has now left the organisation and we do not had enough information for access. We contacted apple and we got Alisas to original Apple ID account after that we were able to create app-specific password. We are not sure if this alias account access is affecting our issue or may be there is some particular setting that could affect the authorisation.

Below are the complete info regarding the issue.
 mohd.faizan@KELLGGNLPTP1659 ~ % xcrun notarytool store-credentials --verbose --apple-id “XXXX" --password “YYYY” --team-id “ZZZZ” [11:32:40.047Z] Debug [MAIN] Running notarytool version: unknown (0), date: 2024-04-23T11:32:40Z, command: /Applications/Xcode.app/Contents/Developer/usr/bin/notarytool store-credentials --verbose --apple-id XXXX --password private<String> --team-id ZZZZ

This process stores your credentials securely in the Keychain. You reference these credentials later using a profile name.

Profile name: NotaryProfile Validating your credentials... [11:32:48.390Z] Info [API] Initialized Notary API with base URL: https://appstoreconnect.apple.com/notary/v2/ [11:32:48.392Z] Info [API] Preparing GET request to URL: https://appstoreconnect.apple.com/notary/v2/test?, Parameters: [:], Custom Headers: private<Dictionary<String, String>> [11:32:48.393Z] Debug [AUTHENTICATION] Delaying current request to refresh app-specific password token. [11:32:48.393Z] Info [API] Preparing GET request to URL: https://appstoreconnect.apple.com/notary/v2/asp?, Parameters: [:], Custom Headers: private<Dictionary<String, String>> [11:32:48.394Z] Debug [AUTHENTICATION] Authenticating request to '/notary/v2/asp' with Basic Auth. Username: XXXX, Password: private<String>, Team ID: ZZZZ [11:32:48.396Z] Debug [TASKMANAGER] Starting Task Manager loop to wait for asynchronous HTTP calls. [11:32:50.102Z] Debug [API] Received response status code: 401, message: unauthorized, URL: https://appstoreconnect.apple.com/notary/v2/asp?, Correlation Key: 5WDGB4XPJJAUCMTFMR6TUYYRPI [11:32:50.103Z] Error [TASKMANAGER] Completed Task with ID 2 has encountered an error. [11:32:50.103Z] Debug [TASKMANAGER] Ending Task Manager loop. Error: HTTP status code: 401. Unable to authenticate. The application is not allowed for primary authentication. Ensure that all authentication arguments are correct.


Can anyone help me in resolving this issue?  What steps do I need to take to fix this? Thanks in advance for the help.