Clasp Could not read API credentials. Are you logged in globally?

时光毁灭记忆、已成空白 提交于 2021-01-28 08:52:45

问题


I'm logging in with clasp login --creds <file> which produces a local .clasprc.json file. It says that I am logged in, but when I run another command I get:

Could not read API credentials. Are you logged in globally?

Any thoughts on why its not looking at my local clasprc file first?

Currently using version clasp v. 2.2.0


回答1:


I ran into the same problem on Windows 10 and found that you need to login both globally and locally to use clasp run. There should be a .clasprc.json file in both your project folder and user folder.




回答2:


I think I have finally found the solution for the same problem
Follow along with the comments from this github issue
Add the "oauthScopes" field to your local code and push it to your app
If you can't push, then copy-paste it to manifest file in the browser
Then you have to publish the app, and there were few things I've done, not sure which one helped. In the app in browser:

  • add the app version in File->Manage Versions

  • Publish -> Deploy as API executable

  • try to login with clasp and creds.json file

  • try to run something clasp run testRun

it may show the error that you're missing some oauth permissions, but it will list which ones, and you can add them

In my case, one weird thing that also helped was to enable some Google API so in the app in browser: Resources -> Advanced Google Services -> enable some API then try to do clasp run
if it works, you can disable the API that you have enabled previously.

Hope that helps



来源:https://stackoverflow.com/questions/61103988/clasp-could-not-read-api-credentials-are-you-logged-in-globally

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