title: NodeJS: Google Sign-In for server-side apps
body: <p>Following this <a href="https://developers.google.com/identity/sign-in/web/server-side-flow" rel="nofollow noreferrer">documentation</a> I succeed to perform Google Sign-In for server-side apps and have access to user's GoogleCalendar using Python on server side. I fail to do that with NodeJS.</p>
  
  <p>Just in a nutshell - with Python I used the <code>auth_code</code> I've sent from the browser and got the credentials just like that:</p>
  
  <pre><code>from oauth2client import client
  
  credentials = client.credentials_from_clientsecrets_and_code(
      CLIENT_SECRET_FILE,
      ['https://www.googleapis.com/auth/drive.appdata', 'profile', 'email'],
      auth_code)
  </code></pre>
  
  <p>Then I could store in DB the value of:</p>
  
  <pre><code>gc_credentials_json = credentials.to_json()
  </code></pre>
  
  <p>And generate credentials (yes it uses the refresh_token alone when it's needed):</p>
  
  <pre><code>client.Credentials.new_from_json(gc_credentials_json)
  </code></pre>
  
  <p>So I want to do the same using NodeJS:</p>
  
  <ol>
  <li><p>easily generate credentials using just: <code>CLIENT_SECRET_FILE</code>, <code>scopes</code> and <code>auth_code</code> (just like I did with Python)</p></li>
  <li><p>receive credentials using previous credentials value without analysing if the access token is expired - I prefer a ready (well tested by the community) solution</p></li>
  </ol>
  
  <p>Thank you in advance!</p>