title: How to get access token via Google JavaScript oauth2 API
body: <p><a href="http://api.chan15.info/google-stackoverflow.html" rel="nofollow">http://api.chan15.info/google-stackoverflow.html</a></p>
  
  <p>This is the sample code I use to let user login via Google JavaScript API, and it's work, next step is use user id to login to local server via PHP, but use the user id by JavaScript is pretty danger, the real procedure I want is:</p>
  
  <ol>
  <li>login user via JavaScript API</li>
  <li>get access_token from JavaScript</li>
  <li>pass the access token to PHP</li>
  <li>use access token to Google OAuth to get user id again by PHP</li>
  <li>login the user by user id</li>
  </ol>
  
  <p>but I don't know how to get access token.</p>