Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bq cmd query Google Sheet Table occur "Access Denied: BigQuery BigQuery: No OAuth token with Google Drive scope was found" Error

I have a table connect with Google Sheet, use WebUI query this table success, but if I use bq cmd query, It will echo error msg:

Access Denied: BigQuery BigQuery: No OAuth token with Google Drive scope was found

like image 276
Karl Lin Avatar asked Sep 13 '17 13:09

Karl Lin


2 Answers

I presume you are using bq command line tool which comes with Cloud SDK.

To use bq you had to procure credentials, most likely you used

gcloud auth login

By default these credentials do not get drive scope. You have to explicitly request it via

gcloud auth login --enable-gdrive-access

Now running bq to access Google Drive data should work.


From the comments: for some people, it seems to be necessary to run

gcloud auth revoke

before logging in again. (Deleting ~/.config/gcloud would also work, but is probably overkill.)

like image 163
cherba Avatar answered Oct 08 '22 20:10

cherba


Run auth revoke then auth login if only the latter doesn't work.

gcloud auth revoke
gcloud auth login --enable-gdrive-access
like image 44
Yoichi Tagaya Avatar answered Oct 08 '22 20:10

Yoichi Tagaya