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

纵饮孤独 提交于 2019-12-20 12:37:04

问题


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


回答1:


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.)




回答2:


Chances are the 'https://www.googleapis.com/auth/drive.readonly' scope is missing in the credentials of your request.

For details, see: Credentials Error when integrating Google Drive with




回答3:


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

gcloud auth revoke
gcloud auth login --enable-gdrive-access



回答4:


Hi, I know what happen, before gcloud auth login --enable-gdrive-access, I need delete ~/.config/gcloud folder, thanks!! – Karl Lin Sep 14 '17 at 12:32

Here's the complete answer based on Karl Lin's comment to the accepted answer.

rm -rf ~/.config/gcloud 
gcloud auth login --enable-gdrive-access

I needed to delete ~/.config/gcloud or it won't work.



来源:https://stackoverflow.com/questions/46198832/bq-cmd-query-google-sheet-table-occur-access-denied-bigquery-bigquery-no-oaut

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!