If authentication fails? If authentication fails, the user doesn't get in. If the user doesn't get in, there's no code to run that would ask for the user name.
If, however, the user is in an area that doesn't require authentication, there can be code that looks for the user name. It won't find anything though. Both methods will return null, just as the API says.