I have been trying to add items with stored credentials to ArcGIS Online and I am not having any luck. When I first add the url to the service, it successfully identifies it is secured and the toggle button to store the credentials with the item appears.
After retrieving the service info it prompts me for the credentials, but not in the add content pane, but in a new pop-up. I fill in the credentials and it seems to work (I can see a token is generated and received in the developer tools), but then it asks for the credentials again, but this time in the same window for add content. When I enter my credentials this time it says the credentials are invalid - invalid username or password, even though I am using the exact same credentials.
The same for any items I had created in the past with stored credentials. When I go to the item and select the data tab, it returns me back with a data error. I can see that a token is generated and returned from my ArcGIS Server, but the layer doesn't load properly.
I am able to access items that use ArcGIS Server credentials where the user has to input it when they access the item, and the token generation is also working for our Geocortex mapviewers.
There are no errors in my ArcGIS SErver log indicating that the wrong credentials were used either and the same user and password are used successfully by non-ArcGIS online applications.
I just successfully added the same layer to our Portal environment from the same ArcGIS Server with the same stored credentials. So I think this is an ArcGIS Online issue.