Hi,
I am trying to have google one tap login popup but its not showing up. Here is my code:
in my index page:
data-client_id="???"
data-login_uri='/google-response'>
in my controller page:
[Route("google-response")]
public async Task GoogleResponse()
{
var google_csrf_name = "g_csrf_token";
var cookie = Request.Cookies[google_csrf_name];
if (cookie == null)
return StatusCode((int)HttpStatusCode.BadRequest);
var requestbody = Request.Form[google_csrf_name];
if (requestbody != cookie)
return StatusCode((int)HttpStatusCode.BadRequest);
var idtoken = Request.Form["credential"];
GoogleJsonWebSignature.Payload payload = await GoogleJsonWebSignature.ValidateAsync(idtoken).ConfigureAwait(false);
TempData["name"] = payload.Name;
TempData["email"] = payload.Email;
return Json(payload);
}
} I added the following packages:
Google.Apis.Auth and Microsoft.AspNetCore.Authentication.Google I try to run the above but nothing is showing.
Can you help. Thanks