The login in the Storyblok CLI via storyblok login works fine.
However, if you add 2 Factor Authentication via e.g. SMS to the account, you get the SMS token and can log in successfully too.
As soon as you execute a command like
generate-migration and enter the respective space, you are asked to log in again (even though you are already logged in) and then you get a 401 error:
? Enter your email address: firstname.lastname@example.org
? Enter your password: [hidden]
? We sent a code to your email/phone, please insert the authentication code: ----code—
✓ Log in successfully! Token has been added to .netrc file.
X An error occurred when loading the components from space: Unauthorized
X An error occurred when generating the migration file: Request failed with status code 401
After removing the Two Factor Authentication an re-sign in to the CLI everything is working fine again.