gpt4 book ai didi

ios - Google Natural Language API 权限被拒绝错误

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:37:37 26 4
gpt4 key购买 nike

直到昨天,Google Natural Language API 一直在我的 iOS 应用程序中运行。从今天早上开始,API 开始返回“权限被拒绝”错误。例如:

{
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
}

示例请求:

POST /v1/documents:analyzeEntities?key=..... HTTP/1.1
Host: language.googleapis.com
Content-Type: application/json
Connection: keep-alive
X-Ios-Bundle-Identifier: .....
Accept: */*
Accept-Language: en-us
Content-Length: 291
Accept-Encoding: gzip, deflate
User-Agent: CardScanner/1 CFNetwork/808.2.16 Darwin/15.6.0

{"encodingType":"UTF8","document":{"type":"PLAIN_TEXT","content":"....."}}

帐户已启用计费(余额为 0 美元)。该帐户还有 36 天的试用期。

key 与 Google Cloud Platform API 仪表板中的值匹配。我还尝试重新生成 key ,并在应用程序中使用新 key 。

我还尝试为 iOS 设备启用 key 限制,并在应用程序包标识符中包含“X-Ios-Bundle-Identifier” header 。

该应用程序还使用了可以正常运行的 Google Vision API。对 Vision API 的调用确实会响应 key 限制的更改。

来自 demo page 的调用还显示权限错误消息。来自 API explorer 的电话然而,做工作。

编辑:

错误也发生在 demo on the product web page 上.跟踪 Charles 中的错误显示返回到网页的相同“权限被拒绝”响应:

enter image description here

编辑:

下面是从演示页面捕获的 HTTP 请求和响应的示例。请求和产生的错误与我的应用程序几乎相同,只是演示似乎使用的是 http 2,而我的应用程序使用的是 http 1。

HTTP请求:

:method: POST
:authority: language.googleapis.com
:scheme: https
:path: /v1/documents:analyzeEntities?key=.....
content-length: 250
origin: https://cloud.google.com
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
content-type: text/plain;charset=UTF-8
accept: */*
referer: https://cloud.google.com/natural-language/
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.8

{"document":{"type":"PLAIN_TEXT","content":"Google, headquartered in Mountain View, unveiled the new Android phone at the Consumer Electronic Show. Sundar Pichai said in his keynote that users love their new Android phones."},"encodingType":"UTF16"}

HTTP 响应:

:status: 403
vary: Origin
vary: X-Origin
vary: Referer
content-type: application/json; charset=UTF-8
content-encoding: gzip
date: Sun, 26 Feb 2017 14:52:24 GMT
server: ESF
cache-control: private
content-length: 128
x-xss-protection: 1; mode=block
x-frame-options: SAMEORIGIN
x-content-type-options: nosniff
access-control-allow-origin: https://cloud.google.com
access-control-expose-headers: content-encoding,date,server,content-length
alt-svc: quic=":443"; ma=2592000; v="35,34"

{
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
}

最佳答案

我们知道这个问题,现在应该解决。如果您仍然遇到同样的问题,请告诉我们。

关于ios - Google Natural Language API 权限被拒绝错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42431787/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com