无法使用 identity.getAuthToken 在 chrome 扩展程序中获取令牌



我无法使用以下命令获取身份验证令牌

chrome.identity.getAuthToken({interactive: true}, token => {
...
}

我收到此错误:

Unchecked runtime.lastError: OAuth2 request failed: Connection failed (-2).

我为 ChromeApp 设置了一个 OAuth 2.0 客户端,并指定了扩展程序的应用程序 ID。还要设置同意页面。 我的清单如下所示:

"permissions": [
"storage",
"identity"
],
"key": "<my application key>",
"oauth2": {
"client_id": "<my client id>.apps.googleusercontent.com", 
"scopes": [
"openid", "email", "profile"
]
}

如何修复或至少调试此问题?

我也有这个问题,我注意到我一开始并没有使用 Chrome,而是在使用 Microsoft Edge。

确保您使用的是 Chrome。

最新更新