android - (Unity) 无法在 android 上使用 google play 服务进行身份验证
问题描述
我在尝试在我的 android 游戏上进行身份验证时遇到问题,我使用 playfab + google play 服务在 google 上进行身份验证,但我什至无法到达我使用 google 帐户在 playfab 上进行身份验证的部分,Social.localUser.Authenticate
永远不会成功并且它返回的消息在回调中是“身份验证取消”,我得到的唯一有用的日志消息是
[Play Games Plugin DLL] 应用程序正在暂停,这会断开 RTMP 客户端。离开房间。身份验证取消 [Play Games Plugin DLL] 调试:在游戏线程上调用用户回调
有时它会抛出
[Play 游戏插件 DLL] 启动 Auth 转换。操作:SIGN_IN 状态:ERROR_TIMEOUT
或者
[Play 游戏插件 DLL] 启动 Auth 转换。操作:SIGN_IN 状态:ERROR_NOT_AUTHORIZED
但仅此而已。最奇怪的是它打开了 Google Play Games 弹出窗口,它要求权限,我接受它,一切都按预期进行,但在应用程序中它永远不会成功。我已经在 Playfab 上注册了平台插件,在 google 开发者控制台上添加了一个链接的 web 应用程序,将客户端 oauth id 和 secret 复制到 playfab,配置了重定向的 uri 和端点链接(参考:https: //www.youtube .com/watch?v=FIse9VOk-FE,https: //api.playfab.com/docs/tutorials/landing-players/sign-in-with-google )。但是这些都不起作用,我无法对其进行身份验证,无论它是否通过 Playstore 安装,我唯一没有尝试过的是将它作为 Playstore 上的 alpha 版本进行测试,目前正在进行内部测试.
[更新 1:] 我在清醒时使用的代码:
PlayGamesClientConfiguration config = new
PlayGamesClientConfiguration.Builder()
.AddOauthScope("profile")
.WithInvitationDelegate(GoogleInvitation)
.WithMatchDelegate(GoogleMatch)
.RequestEmail()
.RequestServerAuthCode(false)
.RequestIdToken()
.Build();
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.DebugLogEnabled = true;
PlayGamesPlatform.Activate();
我用来登录的代码:
Social.localUser.Authenticate((success, message) =>
{
Debug.Log("Authentication Message: " + message);
if (success)
{
var serverAuthCode = PlayGamesPlatform.Instance.GetServerAuthCode();
_AuthService.AuthTicket = serverAuthCode;
_AuthService.Authenticate(Authtypes.Google);
}
else
{
Debug.Log("Failed authenticating with google");
}
});
解决方案
你能提供一些代码吗?首先我认为你需要打电话
PlayGamesPlatform.Activate()
之后,所有社交功能都应该起作用。
此外,要实际测试 google play 服务,您需要将您的应用程序部署到 alfa/beta 测试或在 Play Market 中发布并从市场下载,否则它实际上不会工作。
推荐阅读
- python - 根据索引对多维数组中的元素求和
- mysql - SQL GROUP BY INNER JOIN 和 COUNT
- php - Laravel 5.2:预期响应代码 220,但得到代码“500”,消息“500 Unrecognized command”
- asp.net-core - 在 Scrutor 中多次使用 AddClasses
- python - 哪个 numpy 索引是副本,哪个是视图?
- javascript - 如果属性与比较值不匹配,如何更改数组中对象属性的值?
- python - pandas 按相同键对分组项目进行过滤
- c# - 在 Clickhouse 客户端中禁用 SQL 日志记录
- python - 我正在尝试使用 CSV 文件中的数据绘制饼图,但出现我不明白的错误
- javascript - 使用 js 添加 html 后标签链接不起作用