I have noticed that when connecting to AGOL or Portal the username is case sensitive. I am curious why this is, it certainly makes writing scripts more difficult as I need to go back through the web to make sure the usernames are 100% matching
User names are case sensitive according the Account Troubleshoot Help page. This Stack Overflow article discusses some reasons why, but increased security is the most obvious and strongest reason for doing so. AGOL supports federation with enterprise logins which may also require case sensitive user names. If you have usernames stored inconsistently across various tables or systems, you may want to add the .lower() method on any code that is handing user name strings.
We were having a problem adding SAML usernames into our portal. When the user went to login for the first time they would see this error: Unable to assign user 'UserName@domain' to this account '0123456789ABCDEF' , Username is not available. Note that it actually displayed 0123456789ABCDEF. The username is actually case sensitive. In ADFS the email address was capitalised on the first and last name, when we matched the case when adding the account in portal then the user had no problem logging in for the first time. ArcPortal is NOT case sensitive so it recognised the user name but when it tried to authenticate with ADFS, the case did not match and so authentication failed and the error appeared - not a helpful message.