This seems to be the same issue as mentioned at (When oauth/token is called, you can't access) where axios requires specific handling for sending data with the content type being stated in the header.
The above would mean that the sample code is likely broken; can you attempt to perform the suggestion provided in that linked question. I’ll also try to test this myself so I can request a docs update.