Snapcraft login stopped working

I am unable to log into snapcraft when using snap deployment.

echo "W2xv****************" | snapcraft login --with -
fails with:
Failed to authenticate

This worked before and still works when I execute the code with the token from the command line. I also regenerated the token but with no effect.