在 Android 应用程序中使用 Facebook 评分 API? [英] Using Facebook scores API in an Android App?

查看:34
本文介绍了在 Android 应用程序中使用 Facebook 评分 API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将 facebook 的分数 API 集成到 Android 游戏中.我遇到了与这个问题完全相同的问题:Facebook Graph API Explorer won't POST分数.解决方法是将我的应用程序设置为 Web 而不是本机/桌面.是不是因为原生游戏不应该使用score API?为原生应用设置 Web 是否有些危险?

I am integrating the scores API for facebook in an Android game. I had the exact same problem as this question: Facebook Graph API Explorer won't POST scores. The fix was to set my app as Web instead of Native/Desktop. Is it because scores API should not be used by native games? Is it somehwat dangerous to set up Web for a Native app?

谢谢

推荐答案

我也注意到了这一点,但是我想知道使用 Facebook Scores API 是否是设计使然",您需要访问应用程序访问令牌(在为了做诸如提交分数之类的事情)但是这不被认为是从本机应用程序使用的安全事情.引用如下:

I have noticed this too, however I wondered if it is 'by design' as to use the Facebook Scores API you need access to the app access token (in order to do things like submit scores) however this isn't considered a safe thing to use from a native application. Here is a quote:

仅当发布功能直接来自您的服务器时才应使用应用访问令牌,以确保它们对应用保持私密性.例如,您不应使用原生移动应用内的应用访问令牌进行发布.这样做可以让用户获得应用程序访问令牌,然后他们可以代表您的应用程序执行操作.相反,您应该让您的原生移动应用程序将操作与您的服务器一起排队,然后让您的服务器发布故事使用应用访问令牌访问 Facebook."

"App Access Tokens should only be used when the posting functions are originated directly from your servers in order to keep them private to the app. For example, you should not publish using an App Access Token from within a native mobile app. Doing that could allow the user to obtain the App Access Token, which could then allow them to take actions on behalf of your app. Instead, you should have your native mobile app queue actions up with your server and then have your server publish the stories to Facebook using the App Access Token."

这是有问题的网站:http://developers.facebook.com/docs/opengraph/using-app-tokens/.

所以,听起来真正使用 Scores API 的唯一方法是让本机应用程序安全地与一个单独的、安全的服务器(可能在 Heroku 上)通信,然后一旦该服务器验证了传递的数据,它就会与 Facebook 交谈并使用应用访问令牌提交分数(它可以安全地使用而无需用户获取).

So, it sounds like the only way to really use the Scores API is to have the native application securely talk to a separate, secure, server (potentially on Heroku) then once that server has verified the passed data, it would then talk to Facebook and submit the score using the app access token (which it can safely use without the user getting hold of it).

最重要的是,Facebook Scores API 仅支持每个应用程序(而不是每个级别、每个模式等)的分数,因此为了获得更高级的任何东西,无论如何都需要额外的服务器,因此数据库可以存储将 Facebook 用户 ID 映射到人们希望评分的各种分数.

On top of this, the Facebook Scores API only supports having one score per application (not per level, per mode, etc.) scores, so in order to have anything more advanced the extra server is required anyway, so a database can be stored that maps Facebook user IDs to the various scores one wishes to score.

这篇关于在 Android 应用程序中使用 Facebook 评分 API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆