Initial setup: wrangler preview gives 'Bad Request'

I just started experimenting with workers by following the ‘Introduction to Cloudflare Workers’ course. As instructed, I did the following:

  • ‘wrangler generate testapp’ to initialize the project
  • Enter account ID in wrangler.toml file
  • Used ‘wrangler login’ to get an API key

Now I do ‘wrangler preview’ and I get following error:
Error: Something went wrong! Status: 400 Bad Request, Details {“success”:false,“errors”:[{“code”:10000,“message”:“Authentication error”}]}

I could not find any solution online to this error…