I have a SPA implemented in Angularjs - Typescript calling VSO API and providing authentication data you can find below:
I found that this happened to me when my PAT was wrong due to a copy and paste error.
Looks like you are probably failing authentication because you didn't base64 encode the bearer token.