相关疑难解决方法(0)

chrome.identity.getAuthToken不起作用

我正在使用Chrome Identity API,以便在Chrome扩展程序中为用户提供Google身份验证.

我按照谷歌的官方教程: 链接Chrome Identity API

  • 我添加了manifest.json客户端ID范围的权限
  • 为了触发Authentification,我在Background.js中添加了这段代码

chrome.identity.getAuthToken

问题是,当我执行扩展时,我被重定向到此登录页面

铬://铬登入/源= 5

但在成功验证后,我又被重定向到登录页面

问题是什么 ?

的manifest.json

{
  "name": "My Extension",
  "short_name": "Ex App",
  "version": "0.1",
  "description": "description",
  "manifest_version": 2,
  "icons": { "128": "ICONE.png", "48": "ICONE1.png" },
  "permissions": ["contextMenus", "identity", "cookies", "http://*/*",   "https://*/*", "<all_urls>", "unlimitedStorage"],
  "browser_action": {
    "default_title": "Title",
    "default_icon": "imgIcone.png"
  },
  "oauth2": {
        "client_id": "xxxxxxx",
        "scopes": [
            "https://www.googleapis.com/auth/userinfo.email"
    ]   
},   

  "background": {
    "scripts": ["background.js"]
  },

    "content_scripts"   : [
{
  "matches": ["*://*.google.com/*"], …
Run Code Online (Sandbox Code Playgroud)

google-chrome-extension google-oauth google-chrome-app

14
推荐指数
2
解决办法
5263
查看次数