playgameservices / play-games-plugin-for-unity

Google Play Games plugin for Unity
Other
3.43k stars 953 forks source link

About User Email #3182

Open sezbladex opened 1 year ago

sezbladex commented 1 year ago

Describe the bug I am using Google play games service with Firebase, I try get email it looks empty How can i get authenticated user email ?

Versions

Additional context Add any other context about the problem here.

hippogamesunity commented 1 year ago

+1

BrotherMus commented 1 year ago

+1

hippogamesunity commented 1 year ago

10.14 is the last version where you can get Login and it's still working at least.

BrotherMus commented 1 year ago

10.14 is the last version where you can get Login and it's still working at least.

u call by social.localuser or what?

                test.text = "Name : " + Social.localUser.userName;
                test1.text = "ID : " + Social.localUser.id;

because this is what i code when to call username and id, but when typing email not came out

hippogamesunity commented 1 year ago
var config = new PlayGamesClientConfiguration.Builder().RequestEmail().Build();

PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.DebugLogEnabled = true;
PlayGamesPlatform.Activate();
PlayGamesPlatform.Instance.Authenticate(SignInInteractivity.CanPromptAlways, status =>
{
    var user = (PlayGamesLocalUser) Social.localUser;
    var success = status == SignInStatus.Success;
    var error = success ? null : $"Authenticate failed ({status}).";

    callback(success, error, new SocialUser(user.id, user.Email, user.userName));
});
sezbladex commented 1 year ago

Thank you for answer

BrotherMus commented 1 year ago
var config = new PlayGamesClientConfiguration.Builder().RequestEmail().Build();

PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.DebugLogEnabled = true;
PlayGamesPlatform.Activate();
PlayGamesPlatform.Instance.Authenticate(SignInInteractivity.CanPromptAlways, status =>
{
    var user = (PlayGamesLocalUser) Social.localUser;
    var success = status == SignInStatus.Success;
    var error = success ? null : $"Authenticate failed ({status}).";

    callback(success, error, new SocialUser(user.id, user.Email, user.userName));
});

image