[英]api key with google document ai
I am using the form parser of google document ai.我正在使用谷歌文档 ai 的表单解析器。 The only way to authenticate that I have found is through gcloud command interface ("Authorization: Bearer "$(gcloud auth application-default print-access-token)).
我发现的唯一身份验证方法是通过 gcloud 命令界面(“Authorization: Bearer”$(gcloud auth application-default print-access-token))。
Our application uses Google Vision too and just needs an api key ( https://vision.googleapis.com/v1/images:annotate?key= )我们的应用程序也使用 Google Vision,只需要一个 api 密钥( https://vision.googleapis.com/v1/images:annotate?key= )
How can I use this way google document AI?我怎样才能使用这种方式谷歌文档AI?
I have tried with the api key in /apis/credentials and I have tried to restrict the key to ip too and to document ai api, but all with the same result:我已经尝试使用 /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"
}
}
What am I missing?我错过了什么?
Request is missing required authentication credential.
请求缺少所需的身份验证凭据。
Means that you have not sent any authorization with your request表示您没有随请求发送任何授权
The request you are attempting requires that you send an access token along as a bearer token您尝试的请求要求您发送访问令牌作为不记名令牌
curl -H "Authorization: bearer <ACCESS_TOKEN>" http://www.example.com
You appear to only be sending an API key which will only grant you access to public data not private user data.您似乎只发送了一个 API 密钥,它只会授予您访问公共数据而非私人用户数据的权限。
The Document AI Quickstart shows how to setup Authentication for the Document AI API.文档 AI 快速入门展示了如何为文档 AI API 设置身份验证。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.