Authentication issues are some of the hardest issues to troubleshoot. Each API provider can customize how it does authentication. Plus, the error messages tend to have very limited information since you are not able to authenticate as an approved user.
Your best bet is to look at the documentation for the API provider and/or contact their support.
On the other hand, if they indeed use basic authentication, you can try changing this line
letauthKey = authUser + authPass
to letauthKey = authUser + ":" + authPass
When writing code, even small character differences can matter.
Thanks @kuovonne I figured it out. I had the username and password so I used postman to get the data and then I used the code generator feature postman to generate the script for the authentication. Now I have been able to used it to generate the data in airtable