How to get user birth date from Google-Sign-In plugin?

Hello everyone.
I’m using Google sign In plugin to authenticate users:

It works well so far:

public void SignIn() {
    GoogleSignIn.Configuration = configuration;
    GoogleSignIn.Configuration.UseGameSignIn = false;
    GoogleSignIn.Configuration.RequestIdToken = true;

    AddStatusText("Calling SignIn");
   GoogleSignIn.DefaultInstance.SignIn().ContinueWith(OnAuthenticationFinished);
}
public async void SignOut() {
    AddStatusText("Calling SignOut");
    var signInUser = await GoogleSignIn.DefaultInstance.SignIn();
    GoogleSignIn.DefaultInstance.SignOut();
}

private void OnAuthenticationFinished(Task<GoogleSignInUser> task) {
    if (task.IsFaulted) {
        using (IEnumerator<Exception> enumerator =
                task.Exception.InnerExceptions.GetEnumerator()) {
            if (enumerator.MoveNext()) {
                GoogleSignIn.SignInException error =
                        (GoogleSignIn.SignInException)enumerator.Current;
                //AddStatusText("Got Error: " + error.Status + " " + error.Message);
                AddStatusText("error: "+error.Message);
            } else {
                AddStatusText("Got Unexpected Exception?!?" + task.Exception);
            }
        }
    } else if (task.IsCanceled) {
        AddStatusText("Canceled");
    } else {
        //got authed user
        var user = task.Result;// no birth date here :(
        AddStatusText("Welcome: " + user.DisplayName);
        OnSignIn?.Invoke(user);
    }
}

The problem is I need to receive a birth date if it was set.
Unfortunatelly plugin returns only basic user info(display name,user id, email, etc.)
Is there api to get additional user data like birth date?

This is less to do with Unity or Scripting and has more to do with what information google makes available via the Google Sign-In Credential Manager.

I don’t personally know as I don’t really mess around with the Google APIs outside of basic stuff because mining people’s data out of it is something I don’t generally need for my games. But I do know when making apps for Android and iOS you have to inform the user what data you might read from them and they have to approve that before you can and I could see that access being restricted to another part of the API than just the credential-manager aspect.

With all that said… your best bet is to research outside of the context of Unity. Look around as to how to get this information through the Google APIs. In the end the Unity portion is just wrappers around that logic.

1 Like

2lordofduct Thanx for detailed answer.
I found open issue on the plugin’s github page

This is exactly my case.
I think I’d better use date picker component.

You’ll probably want the datepicker regardless since not everyone is going to have their birthday input there. I know I sure don’t.