The expected response in the line "if (response.data.isauthorised === 0x191)" is "0x191", which in decimal is 401, an error related to invalid credentials.
I replaced "0x191" with any other number, "0x108", which would be 264 in decimal.
This way it will never be error 401, thus validating the script.