Docker login illegal base64 data at input byte

(The category should be “authentication” but I don’t see that (or any other useful) option available)

I used gitlab.com to generate an access token, but when I try

docker login registry.gitlab.com

it gives me

illegal base64 data at input byte 5

This looks like gitlab is generating invalid access-tokens.