google-chrome-extension - 无法使用 identity.getAuthToken 在 chrome 扩展 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。
推荐阅读
- python - QVD 文件到 pandas DataFrame
- python - 在 Django REST 框架中保存数据时,Id 字段显示为空
- windows - runnerw.exe:CreateProcess 失败并出现错误 5:访问被拒绝
- python - 如何在 Windows 电脑上最大化 RTSP 流
- css - CSS Transitions and animations not working
- php - 在 Laravel 8 中使用 SendGrid 发送电子邮件
- python - 如何访问在类的方法中定义的变量?
- docker - 带有反应的docker nginx服务器的CORS错误 - axios
- html - 如何将要点设置在文本顶部?
- python - 编写已经运行的 event_loop 以添加新任务的简单方法