I hope you can help.
This script works locally for Google Analytics Auth, but when I put it on my server & run it with python3 xxx.py and go to the auth URL it redirects to localhost, which fails because it's on the server.
Does anyone have any idea why?
or even a nice Python example of connecting to Google Analytics. I've researched a lot & I couldn't get the examples I've seen working.
import pandas as pd
import requests
from google_auth_oauthlib.flow import InstalledAppFlow
SCOPES = ['https://www.googleapis.com/auth/analytics.readonly']
flow = InstalledAppFlow.from_client_secrets_file('./client_secret.json', SCOPES)
creds = flow.run_local_server(port=0)