title: 500 unauthorized from google oauth login authentication using node and passport
body: <p>I'm running node.js with passport-google-oauth. From my package.json:</p>
  
  <pre><code>"passport-google-oauth": "~1.0.0",
  </code></pre>
  
  <p>I followed this tutorial: <a href="https://scotch.io/tutorials/easy-node-authentication-google" rel="nofollow">https://scotch.io/tutorials/easy-node-authentication-google</a></p>
  
  <p>In google APIs, I set up a project, and I'm using the client-id, client-secret in my express.js javascript. I also use the same redirect url in google APIs and in my javascript.
  Also set my web-app url in the Authorized JavaScript origins</p>
  
  <p>When I try to login using my google account, I'm taken to a google page, then I press "allow", and the page is redirected to my redirect url. Then, I get this (ommitted paths from stacktrace):</p>
  
  <p>Unauthorized
  500</p>
  
  <p>TokenError: Unauthorized</p>
  
  <pre><code>at Strategy.OAuth2Strategy.parseErrorResponse 
  at Strategy.OAuth2Strategy._createOAuthError
  at node_modules/passport-google-oauth/node_modules/passport-google-oauth20/node_modules/passport-oauth2/lib/strategy.js:166:45
  at node_modules/passport-google-oauth/node_modules/passport-google-oauth20/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:177:18
  at passBackControl 
  at IncomingMessage.&lt;anonymous&gt;
  at IncomingMessage.emit (events.js:117:20)
  at _stream_readable.js:944:16
  at process._tickCallback (node.js:448:13)
  </code></pre>
  
  <p>Has anyone experienced this or knows what the problem may be?</p>