谷歌 API 宝石中的"Missing Access Token"



我正在尝试将类似google-api-gem的命令与预测api一起使用。我想我一直在做这件事,就像我读到的一样,但它一直给我错误"缺少访问令牌"。

首先,我通过oauth1进行身份验证。它会将我带到登录页面,在那里我登录并授予访问权限。登录后,它关闭,并且在~/.google-api.yaml中创建了一个文件,其中包含token_credential_secrettoken_credential_key

google-api oauth-1-login --scope https://www.googleapis.com/auth/prediction

我现在应该通过身份验证了,不是吗?当我尝试执行一个命令时,它会得到Missing Access Token

google-api execute prediction.training.insert "data=bucket/train.csv"

我一直在网上搜寻这个答案,但运气不佳。谷歌的文档通常不是最新的,这也于事无补。

我删除了过期的文档。如果你看到其他过时的东西,请告诉我。主要问题只是,我一直是Ruby客户的构建者,现在我要搬到肯尼亚,而接管它的人仍在增加。请耐心等待。

改为:

bin/google-api oauth-2-login 
  --scope=https://www.googleapis.com/auth/prediction 
  --client-id=<your-client-id> 
  --client-secret=<your-client-secret>

然后您可以进行API调用:

google-api execute prediction.training.insert -- data=bucket/train.csv

相关内容

最新更新