title: Google Login API Error: invalid_request
body: <p>I am trying to get user details from the default code given by google API... but its poping up an error,</p>
  
  <p>error screen TEXT</p>
  
  <p>**Error: invalid_request </p>
  
  <ol start="400">
  <li>That’s an error.</li>
  </ol>
  
  <p>Error: invalid_request</p>
  
  <p>Application: sampleapp</p>
  
  <p>You can email the developer of this application at: abc@gmail.com</p>
  
  <p>Permission denied to generate login hint for target domain.**</p>
  
  <p>my request</p>
  
  <pre><code>openid.realm=
  scope=https://www.googleapis.com/auth/plus.login
  response_type=permission id_token
  redirect_uri=storagerelay://http/127.0.0.1:51975?id=auth282512
  ss_domain=http://127.0.0.1:51975
  client_id=900278902057-ppqm358qrhki089danipqguj3i4ir70i.apps.googleusercontent.com
  fetch_basic_profile=false
  </code></pre>
  
  <p><strong>Here is the code</strong> </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Google+ JavaScript Quickstart&lt;/title&gt;
    &lt;!-- JavaScript specific to this application that is not related to API
       calls --&gt;
    &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js" &gt;&lt;/script&gt;
      &lt;meta name="google-signin-client_id" content="900278902057-ppqm358qrhki089danipqguj3i4ir70i.apps.googleusercontent.com" /&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;div id="gConnect"&gt;
      &lt;div id="signin-button"&gt;&lt;/div&gt;
    &lt;/div&gt;
    &lt;div id="authOps" style="display:none"&gt;
      &lt;h2&gt;User is now signed in to the app using Google+&lt;/h2&gt;
      &lt;button id="signOut" onclick="auth2.signOut()"&gt;Sign Out&lt;/button&gt;
      &lt;p&gt;If the user chooses to disconnect, the app must delete all stored
      information retrieved from Google for the given user.&lt;/p&gt;
      &lt;button id="disconnect" &gt;Disconnect your Google account from this app&lt;/button&gt;
  
      &lt;h2&gt;User's profile information&lt;/h2&gt;
      &lt;div id="profile"&gt;&lt;/div&gt;
  
      &lt;h2&gt;User's friends that are visible to this app&lt;/h2&gt;
      &lt;div id="visiblePeople"&gt;&lt;/div&gt;
  
      &lt;h2&gt;Authentication Logs&lt;/h2&gt;
      &lt;pre id="authResult"&gt;&lt;/pre&gt;
    &lt;/div&gt;
    &lt;div id="loaderror"&gt;
      This section will be hidden by jQuery. If you can see this message, you
      may be viewing the file rather than running a web server.&lt;br /&gt;
      The sample must be run from http or https. See instructions at
      &lt;a href="https://developers.google.com/+/quickstart/javascript"&gt;
      https://developers.google.com/+/quickstart/javascript&lt;/a&gt;.
    &lt;/div&gt;
  &lt;script type="text/javascript"&gt;
  var auth2 = {};
  var helper = (function() {
    return {
      /**
       * Hides the sign in button and starts the post-authorization operations.
       *
       * @param {Object} authResult An Object which contains the access token and
       *   other authentication information.
       */
      onSignInCallback: function(authResult) {
        $('#authResult').html('Auth Result:&lt;br/&gt;');
        for (var field in authResult) {
          $('#authResult').append(' ' + field + ': ' +
              authResult[field] + '&lt;br/&gt;');
        }
        if (authResult.isSignedIn.get()) {
          $('#authOps').show('slow');
          $('#gConnect').hide();
          helper.profile();
          helper.people();
        } else {
            if (authResult['error'] || authResult.currentUser.get().getAuthResponse() == null) {
              // There was an error, which means the user is not signed in.
              // As an example, you can handle by writing to the console:
              console.log('There was an error: ' + authResult['error']);
            }
            $('#authResult').append('Logged out');
            $('#authOps').hide('slow');
            $('#gConnect').show();
        }
  
        console.log('authResult', authResult);
      },
  
      /**
       * Calls the OAuth2 endpoint to disconnect the app for the user.
       */
      disconnect: function() {
        // Revoke the access token.
        auth2.disconnect();
      },
  
      /**
       * Gets and renders the list of people visible to this app.
       */
      people: function() {
        gapi.client.plus.people.list({
          'userId': 'me',
          'collection': 'visible'
        }).then(function(res) {
          var people = res.result;
          $('#visiblePeople').empty();
          $('#visiblePeople').append('Number of people visible to this app: ' +
              people.totalItems + '&lt;br/&gt;');
          for (var personIndex in people.items) {
            person = people.items[personIndex];
            $('#visiblePeople').append('&lt;img src="' + person.image.url + '"&gt;');
          }
        });
      },
  
      /**
       * Gets and renders the currently signed in user's profile data.
       */
      profile: function(){
        gapi.client.plus.people.get({
          'userId': 'me'
        }).then(function(res) {
          var profile = res.result;
          console.log(profile);
          $('#profile').empty();
          $('#profile').append(
              $('&lt;p&gt;&lt;img src=\"' + profile.image.url + '\"&gt;&lt;/p&gt;'));
          $('#profile').append(
              $('&lt;p&gt;Hello ' + profile.displayName + '!&lt;br /&gt;Tagline: ' +
              profile.tagline + '&lt;br /&gt;About: ' + profile.aboutMe + '&lt;/p&gt;'));
          if (profile.emails) {
            $('#profile').append('&lt;br/&gt;Emails: ');
            for (var i=0; i &lt; profile.emails.length; i++){
              $('#profile').append(profile.emails[i].value).append(' ');
            }
            $('#profile').append('&lt;br/&gt;');
          }
          if (profile.cover &amp;&amp; profile.coverPhoto) {
            $('#profile').append(
                $('&lt;p&gt;&lt;img src=\"' + profile.cover.coverPhoto.url + '\"&gt;&lt;/p&gt;'));
          }
        }, function(err) {
          var error = err.result;
          $('#profile').empty();
          $('#profile').append(error.message);
        });
      }
    };
  })();
  
  /**
   * jQuery initialization
   */
  $(document).ready(function() {
    $('#disconnect').click(helper.disconnect);
    $('#loaderror').hide();
  });
  
  /**
   * Handler for when the sign-in state changes.
   *
   * @param {boolean} isSignedIn The new signed in state.
   */
  var updateSignIn = function() {
    console.log('update sign in state');
    if (auth2.isSignedIn.get()) {
      console.log('signed in');
      helper.onSignInCallback(gapi.auth2.getAuthInstance());
    }else{
      console.log('signed out');
      helper.onSignInCallback(gapi.auth2.getAuthInstance());
    }
  }
  
  /**
   * This method sets up the sign-in listener after the client library loads.
   */
  function startApp() {
    gapi.load('auth2', function() {
      gapi.client.load('plus','v1').then(function() {
        gapi.signin2.render('signin-button', {
            scope: 'https://www.googleapis.com/auth/plus.login',
            fetch_basic_profile: false });
        gapi.auth2.init({fetch_basic_profile: false,
            scope:'https://www.googleapis.com/auth/plus.login'}).then(
              function (){
                console.log('init');
                auth2 = gapi.auth2.getAuthInstance();
                auth2.isSignedIn.listen(updateSignIn);
                auth2.then(updateSignIn);
              });
      });
    });
  }
  &lt;/script&gt;
  &lt;script src="https://apis.google.com/js/client:platform.js?onload=startApp"&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>