title: How to solve "idpiframe_initialization_failed" for localhost?
body: <p>Here's my initialization code:</p>
  
  <pre><code>            function HandleGoogleApiLibrary() {
                  // Load "client" &amp; "auth2" libraries
                  gapi.load('client:auth2', {
                      callback: function () {
                          // Initialize client &amp; auth libraries
                          gapi.client.init({
                              apiKey: 'My API Key',
                              clientId: 'My Client ID',
                              scope: 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/plus.me'
                          }).then(
                              function (success) {
                                  console.log("Yaaay");
                              },
                              function (error) {
                                  console.log("Nope");
                                  console.log(error);
                              }
                          );
                      },
                      onerror: function () {
                          // Failed to load libraries
                      }
                  });
              }
  </code></pre>
  
  <p>Which gives me the following error message:</p>
  
  <pre><code>details: "Not a valid origin for the client: http://127.0.0.1 has not been whitelisted for client ID 388774754090-o7o913o81ldb2jcfu939cfu36kh9h0q6.apps.googleusercontent.com. Please go to https://console.developers.google.com/ and whitelist this origin for your project's client ID."
  error: "idpiframe_initialization_failed"
  </code></pre>
  
  <p>My app is not in production yet, so for development I'm using localhost. Thing is, on <em>every</em> stack overflow / reference I've found they've specified that on <code>Authorised JavaScript origins</code> and <code>Authorised redirect URIs</code> I must use <code>http://localhost</code> instead of <code>http://127.0.0.1</code>. If I do this, I get that error and a <code>Permission denied to generate login hint for target domain.</code> if I try to login.</p>
  
  <p>If I use <code>http://127.0.0.1</code> on both, I get no <code>idpiframe_initialization_failed</code> on initialization, but get the same permission denied when I try to login. </p>
  
  <p>It makes no sense, there's no other way to specify the localhost, and I just can't use the API. </p>