安卓谷歌登录参考.md 1.6 KB

#安卓

https://blog.csdn.net/qq_39940718/article/details/130029503

https://blog.csdn.net/qq_39940718/article/details/145342207

https://developer.android.com/games/pgs/unity/unity-start?hl=zh-cn

https://docs.unity.com/ugs/zh-cn/manual/authentication/manual/platform-signin-google

![[Pasted image 20250530114657.png]]

这里要注意设置一下,跟商店页面配置要相同

![[Pasted image 20250603100724.png]]

登录相关的调用逻辑

![[Pasted image 20250603142007.png]]

![[Pasted image 20250604093759.png]]

slots谷歌后台物料:

https://inspire.sg.larksuite.com/docx/OH6zdgfoeoIyXxx5fZRlmwQxgBe

谷歌云项目,官网链接:https://console.cloud.google.com 谷歌云项目,创建

![[Pasted image 20250606160409.png]]

开始创建客户端

![[Pasted image 20250606160523.png]]

    /// <summary>
    /// 旧版谷歌登录
    /// </summary>
    public static void OldGoogleSignIn(Action<string, string, string> successComplet, Action failComplet)
    {
GoogleSignIn.Configuration = new GoogleSignInConfiguration  
{  
    WebClientId = "402078875959-ubf3e5d0d6ii83dqof33ifrco8n9n0vg.apps.googleusercontent.com",  
    RequestEmail = true,  
    RequestIdToken = true  
};  
  
GoogleSignIn.DefaultInstance.SignIn().ContinueWith(task =>  
{  
    if (task.IsCompleted && !task.IsFaulted)  
    {        var user = task.Result;  
        string token = user.IdToken;  
    }  
});
    }
    
    /// <summary>
    /// 退出登录
    /// </summary>
    public static void LogoutGoogle()
    {
        GoogleSignIn.DefaultInstance.SignOut();
        Debug.Log("todo Google Play Games 已退出登录");
    }