gpt4 book ai didi

google-chrome-extension - 访问 Chrome Web Store 许可 API 时出现后端错误 500

转载 作者:行者123 更新时间:2023-12-04 05:51:16 36 4
gpt4 key购买 nike

我正在尝试制作一个 chrome 扩展程序,它将免费试用。
遵循文档 here ,首先要做的是启用 Chrome Identity API。据我所知,没有这样的事情......

无论如何......我已经完成了所有其他步骤,最终出现了 500 错误。

这是我所做的一部分。
当然,我更改了所有 ID、键、 token 等的值。

manifest.json

    {
"name": "The name of my app",
"version": "1.0.9",
"key": "my_very_long_key",
"description": "A description",
"manifest_version": 2,
"permissions": [ "activeTab", "storage", "declarativeContent", "identity", "https://www.googleapis.com/" ],
"oauth2": {
"client_id": "the_client_id_i_setup_in_Credentials_oauth2_section.apps.googleusercontent.com",
"scopes": [
"https://www.googleapis.com/auth/chromewebstore.readonly"
]
},
// other stuff...

代码
chrome.identity.getAuthToken({
'interactive': true
}, (token) => {
console.log("Token: %o", token);
console.log("chrome.runtime.id: %o", chrome.runtime.id);

var CWS_LICENSE_API_URL = 'https://www.googleapis.com/chromewebstore/v1.1/userlicenses/';
var req = new XMLHttpRequest();
req.open('GET', CWS_LICENSE_API_URL + chrome.runtime.id);
req.setRequestHeader('Authorization', 'Bearer ' + token);
req.setRequestHeader('Content-Type', 'application/json');

req.onreadystatechange = () => {
if (req.readyState == 4) {
var license = JSON.parse(req.responseText);
console.log(license);
}
}
req.send();
});

这是一个输出示例。
Token: "ya29.GlzqBp1FaFegsgm.oihohjbrbznghdfgmgighnzxfvxz3ve5G8GQ4VxZ653FqBa8aqq-JXil-VS5IGeknneZ6KnKbyknw-gXw"
chrome.runtime.id: "asdflhlkrfhuilerdfb"

Object
error:
code: 500
errors: Array(1)
0:
domain: "global"
message: "Backend Error"
reason: "backendError"
__proto__: Object
length: 1
__proto__: Array(0)
message: "Backend Error"
__proto__: Object
__proto__: Object

所以我能够获得访问 token ,但随后用它调用 API 似乎没有任何结果。

最佳答案

重新打开的错误:https://issuetracker.google.com/issues/140188619

请在 issuetracker.google.com 上给它加星标,如果你有同样的问题来加速谷歌)

更新:

问题已由 Google 修复!
https://bugs.chromium.org/p/chromium/issues/detail?id=940478#c18

关于google-chrome-extension - 访问 Chrome Web Store 许可 API 时出现后端错误 500,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55661469/

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