In following this tutorial: https://ga-dev-tools.appspot.com/embed-api/basic-dashboard/
I generated OAuth2 credentials, enabled the Analytics API and entered my credentials in the clientid field under the javascript that I'm running.
I am hosting this basic page locally with Python HTTP server. I added localhost in every format, including "http://localhost:8080" and "http://localhost" under the credentials' authorized origins and I am still getting the above error. I am stumped. None of the proposed solutions seem to be working as I've followed through with them.
As it turns out, hosting the server online AND clearing cache fixed it.