Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Python authenticating from google api error

I have been trying to get data from the google real time API via a python script,

the python script by itself connects to google api via the Client_secrets.json file and gets me the data in a DataFrame.

 

but when i tried to insert the py script in power bi following the guide i had one error that it could not find the client secrets file.

that was easly resolved by cresting a variable with the location of the file  as displayed below in python.

 

Secrets_File = "C:/Users/xxxxx/Desktop/client_secrets.json"
# Authenticate and construct service.
service, flags = sample_tools.init(
argv, 'analytics', 'v3', __doc__, Secrets_File,

 

Now power bi finds the file opens a webpage to authenticate the oauth2 i presume but i get an error

Error: invalid_scope

Some requested scopes were invalid. {invalid=[https://www.googleapis.com/analytics/v3/data/realtime]}

has anyone successfully connected to the google real time api via python in power bi 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

worked it out 

 

there 2 scopes the readonly scope works because its release version on google servers

scope='https://www.googleapis.com/auth/analytics.readonly')

 

the real time scope that i was using is beta so you cant authenticate it 
scope='https://www.googleapis.com/analytics/v3/data/realtime')

 

you have to authenticate the read only then change it to real time .

and you can get real time data in power bi .

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

worked it out 

 

there 2 scopes the readonly scope works because its release version on google servers

scope='https://www.googleapis.com/auth/analytics.readonly')

 

the real time scope that i was using is beta so you cant authenticate it 
scope='https://www.googleapis.com/analytics/v3/data/realtime')

 

you have to authenticate the read only then change it to real time .

and you can get real time data in power bi .

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.