“缺少访问令牌”在 google-api gem 中

发布于 2024-11-16 12:19:57 字数 573 浏览 3 评论 0原文

我正在尝试将 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

我现在应该已经通过身份验证了不是吗?当我尝试执行命令时,它得到缺少访问令牌

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

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

I'm trying to use the command like google-api gem with the prediction API. I think I've been doing this exactly as I've been reading, but it keeps giving me the error "Missing Access Token".

First I authenticate via oauth1. It brings me to the log in page where I log in and grant access. After I log in, it closes and there is a file created in ~/.google-api.yaml with a token_credential_secret and token_credential_key.

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

I should be authenticated now aren't I? When I try to execute a command, it get Missing Access Token.

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

I've been scouring the internet for this answer, but without much luck. It also doesn't help that google's docs usually aren't up to date.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无人问我粥可暖 2024-11-23 12:19:57

我删除了过时的文档。如果您发现任何其他过时的内容,请告诉我。主要问题很简单,我一直是构建 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

I removed the docs that were out-of-date. Let me know if you see anything else that's out-of-date. Main issue is simply that I've been the person building the Ruby client and now I'm moving to Kenya, and the people who are taking it over are still ramping up. Please bear with us.

Do this instead:

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

Then you can make your API calls:

google-api execute prediction.training.insert -- data=bucket/train.csv
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文