title: Annoying invalid credentials with oauth 2.0 google + api
body: <p>I'm trying to use oauth 2.0 for the google + api on my site, and I keep getting: </p>
  
  <pre><code>{
      "error": {
          "errors": [{
              "domain": "global",
              "reason": "authError",
              "message": "Invalid Credentials",
              "locationType": "header",
              "location": "Authorization"
          }],
          "code": 401,
          "message": "Invalid Credentials"
      }
  }
  </code></pre>
  
  <p>The thing is, I don't know why this is happening. I have a valid access token from google, but google tells be it is invalid. I know that the token has not expired because the json data is request from google within 10 seconds of getting the access token. Here is the process that I'm using:</p>
  
  <ol>
  <li>Get user to authorize the request. </li>
  <li>Gets request code from google.</li>
  <li>Uses <code>cUrl</code> to request access token with the request code from google.</li>
  <li>Puts the access code into a php session.</li>
  <li>redirects back to the main page.</li>
  <li>Main page detects session variable is set and doesn't display login link.</li>
  <li>Php on main page uses <code>readFile</code> to get the json response from google.</li>
  <li>Google returns invalid credentials.</li>
  </ol>
  
  <p>here is a example uri generated by php that is inserted into readFile:</p>
  
  <p><a href="https://www.googleapis.com/plus/v1/people/me?prettyprint=true&amp;access_token=ya29.AHES6ZQRGovDa5FHsojU3qCM1DEnYmJPywz1muUE4CWGH5n70OcAkw">https://www.googleapis.com/plus/v1/people/me?prettyprint=true&amp;access_token=ya29.AHES6ZQRGovDa5FHsojU3qCM1DEnYmJPywz1muUE4CWGH5n70OcAkw</a></p>
  
  <p>Help please?</p>