title: Authenticate Google access token with ASP.NET Core backend server
body: <p>I have Angular2 on client and ASP.NET Core on server side. I use <a href="https://github.com/aspnet/JavaScriptServices" rel="noreferrer">JavaScriptServices</a> (aspnetcore-spa template).<br>
  For authentication I use <a href="https://github.com/openiddict" rel="noreferrer">OpenIddict</a> and I follow example <a href="https://stackoverflow.com/questions/40257981/exchanging-a-google-idtoken-for-local-openid-token-c-sharp/40260960">here</a>.</p>
  
  <p>Now I am on the server side in Controller class method and I would like to validate id_token because this is suggested on <a href="https://developers.google.com/identity/sign-in/web/people" rel="noreferrer">this</a> side:</p>
  
  <blockquote>
    <p>Important: Do not use the Google IDs returned by getId() or the user's
    profile information to communicate the currently signed in user to
    your backend server. Instead, send ID tokens, which can be securely
    validated on the server.</p>
  </blockquote>
  
  <p>And I would also like to register user (save email, profile ...) in my database through ASP.NET Core identity.</p>
  
  <p>I would like to use <a href="https://developers.google.com/api-client-library/dotnet/" rel="noreferrer">Google API client Library for .NET</a> <strong>to get user information</strong> and store refresh_token. Years ago I manage to do it with PHP, but I can't figure it out with .NET.<br>
  I download nuget packages: Google.Apis, Google.Apis.OAuth2.v2, Google.Apis.Plus.v1.</p>
  
  <p>I am not sure which nuget package I need for this, which class should I use, how to set Google ServerKey and how to get user information from information which I get from <a href="https://developers.google.com/identity/sign-in/web/sign-in" rel="noreferrer">gapi.signin2 button</a>.</p>
  
  <p><strong>In simple:</strong><br>
  How can I validate id_token from .NET with Google .NET Client library?</p>