1

I'm trying to retrieve date of birth from google account after user sign in with google but i'm unable to get dateofbirth. I'm using Microsoft.AspNetCore.Authentication.Google Nuget Package to authenticate google user

Here is my code

 // Startup file to authenticate user
 services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie()
.AddGoogle(options =>
{
    options.ClientId = _configuration["GoogleLogin:ClientId"];
    options.ClientSecret = _configuration["GoogleLogin:ClientSecret"];
    options.AccessDeniedPath = "/login";
    options.Scope.Add("https://www.googleapis.com/auth/plus.login");
    options.Scope.Add("https://www.googleapis.com/auth/userinfo.email");
    options.Scope.Add("https://www.googleapis.com/auth/userinfo.profile");
    options.Scope.Add("https://www.googleapis.com/auth/user.birthday.read");
});

// Here is my controller
var externalLoginInfo = await HttpContext.AuthenticateAsync(CookieAuthenticationDefaults.AuthenticationScheme);

this doesn't get any dob only name identifier, Display name, name, surname and email but birthday.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
  • 1
    Does this answer your question? [How to specify the scope of Google API to get the birthday](https://stackoverflow.com/questions/23896424/how-to-specify-the-scope-of-google-api-to-get-the-birthday) – Linda Lawton - DaImTo Aug 14 '23 at 14:33

0 Answers0