title: Google Middlewire Authentication in MVC Core
body: <p>I was trying to add google authentication in my MVC application.
  I followed all the steps and registered the middlewire in Configure method in Startup.cs</p>
  
  <pre><code>   app.UseGoogleAuthentication(new GoogleOptions
          {
              ClientId = Configuration["Google:ClientID"],
              ClientSecret = Configuration["Google:ClientSecret"],
              Scope = { "email", "openid" }
  
          });
  </code></pre>
  
  <p>I am saving ClientID and ClientSecret in appsettings.json.</p>
  
  <p>In developers.google.com I am using G+ api for signin purposes.</p>
  
  <p>using <a href="https://localhost:44386" rel="nofollow">https://localhost:44386</a> as Authorized JavaScript origins</p>
  
  <p>and <a href="https://localhost:44386/signin-google" rel="nofollow">https://localhost:44386/signin-google</a> as Authorized redirect URIs</p>
  
  <p>The issue is the page shows the <strong>Allow</strong> and <strong>Deny</strong> access page and upon clicking on the <strong>Allow</strong> ,the page stays in loading state and never redirects to <code>ExternalLoginConfirmation.cshtml</code> page.</p>
  
  <p>Using default single user authorization mvc core template for this. Any help where I am doing wrong.</p>
  
  <p>This is the OUTPUT stream from my MVC Core app.</p>
  
  <pre><code>Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 GET http://localhost:61356/signin-google?state=CfDJ8MgRzE29TklJksJpDlbDmWeE9W4z9qKrqyko5mov7FHppD2rTlEeUUBP0nFXZ-edch6RmiDobEj-88mvuEG1a_-X087pVbicROYtDDBl1MnQyMxGaN7pImaOhrA_c5XCpRgR3G73GVME-Qk4km2tqO5iP-25ccTwySQYmDd3ham2pmWO5CBwoABnavk9Tu0Ym2XOoWRstcuGEUSqecuj8fLGRMjyBmrBW-mTSXDuKrHu6kLg7kUze48fyjg2o9BHq68JS5F3SA9_q2bqxr2DKg4MrY5vmvJoADmcUAcE6MFONEeQCgEm0j71cdFuIaw46g&amp;code=4/F179kp-WOfRd88aBQPdRsSfynoRwES3gUn7bhHvCw0A&amp;authuser=0&amp;hd=motorolasolutions.com&amp;session_state=f02757ef58689502dbceb4b6cc6bd131dfa2d805..5a04&amp;prompt=consent
  Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationMiddleware:Information: Cookies was not authenticated. Failure message: Unprotect ticket failed
  </code></pre>
  
  <p>Its saying Cookies was not authenticated. Failure message: Unprotect ticket failed.</p>