title: Chrome Extension failed with chrome.identity.launchWebAuthFlow 'Authorization page could not be loaded.'
body: <p>I want to authorize with Google after start extension.</p>
  
  <p>I write manifest.json and background.js as below.</p>
  
  <p><strong>current directory structure</strong></p>
  
  <p><a href="https://i.stack.imgur.com/QqPKT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QqPKT.png" alt="current directory structure"></a></p>
  
  <p><strong>manifest.json</strong></p>
  
  <pre><code>{
    "manifest_version": 2,
    "name": "***************",
    "short_name": "DSBOT",
    "version": "0.0.1.0",
    "description": "**************************",
    "icons": {
      "16": "images/icon_16.png",
      "48": "images/icon_48.png",
      "128": "images/icon_128.png"
    },
    "background": {
      "scripts": [
        "background.js"
      ]
    },
    "browser_action": {
      "default_icon": {
        "19": "images/icon_19.png"
      },
      "default_popup": "popup.html"
    },
    "permissions": [
      "identity",
      "http://*/*",
      "https://*/*",
      "storage"
    ],
    "oauth2": {
      "client_id": **************,
      "scopes": ["openid", "email", "profile"],
      "hd": "zabuton.co.jp"
    }
  }
  </code></pre>
  
  <p><strong>background.js</strong></p>
  
  <pre><code>var clientId = "********************";
  var redirectURL = chrome.identity.getRedirectURL();
  var url = "https://accounts.google.com/o/oauth2/v2/auth?" +
    "scope=email&amp;" +
    "response_type=token&amp;" +
    "client_id=" + encodeURIComponent(clientId) + "&amp;" +
    "redirect_uri=" + encodeURIComponent(redirectURL) + "&amp;" +
    "prompt=consent";;
  
  chrome.identity.launchWebAuthFlow({ url: url, interactive: true }, function(redirect_url) {
    console.log('redirect_url = ' + redirect_url);
  
    if (chrome.runtime.lastError) {
      console.error(chrome.runtime.lastError.message);
    }
  });
  </code></pre>
  
  <p>After install and run, output log 'Authorization page could not be loaded.'.</p>
  
  <p><code>redirect_url</code> inside of <code>launchWebAuthFlow</code> is undefined.</p>
  
  <p>If you know my mistake, please teach me.</p>