Just in case someone comes across this, i had the same problem - the fix was to change browser. In Chrome i had no error, while on Arc, it didn't work - seems like the chrome identity API has some problems when other browsers have some custom Headers.
View this issue thread for more context: https://github.com/brave/brave-browser/issues/7693#issuecomment-3015322687
I understand browsers like Brave & Arc do not support chrome.identity.getAuthToken() because of how Google has designed it.