【发布时间】:2020-12-28 12:44:10
【问题描述】:
我正在使用 google document ai 的表单解析器。 我发现的唯一身份验证方法是通过 gcloud 命令界面(“Authorization: Bearer”$(gcloud auth application-default print-access-token))。
我们的应用程序也使用 Google Vision,只需要一个 api 密钥 (https://vision.googleapis.com/v1/images:annotate?key=)
如何使用这种方式google document AI?
我已尝试使用 /apis/credentials 中的 api 密钥,我也尝试将密钥限制为 ip 并记录 ai api,但结果都相同:
curl -v -X POST -H "Content-Type: application/json; charset=utf-8" -d @request.json https://eu-documentai.googleapis.com/v1beta3/projects/<project id>/locations/eu/processors/<processor id>:process?key=<api key>
{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"status": "UNAUTHENTICATED"
}
}
我错过了什么?
【问题讨论】:
标签: curl google-api google-oauth