While this is a guess, it's possible for your CSRF Token to get "out of sync" temporarily, causing a temporary authentication failure. The CSRF token is a security token which validates your connection to the REST API. If your token stored in your
browser is out of sync with the one your REST API expects, then the REST API will return an authentication failure. However, as part of that authentication failure, your REST API will also return a new CSRF token to re-sync the tokens. So, if they ever get
unsynced, they will resync again immediately. But, this can result in behavior where a login appears to fail, and then succeeds on the second try.
The CSRF token would rarely get out of sync for a normal DSpace user. It's most likely to happen if an advanced user is logging in first through the UI, and then separately through the REST API (Hal Browser)
in the same browser.
That's my best guess on what you may have been seeing.
Tim