问题描述
我想创建一个 Iphone 游戏,用户可以在其中使用他们的 facebook 凭据登录并使用我在 Google App Engine 上运行的服务器进行身份验证.我已经让 Facebook 连接在 iPhone 和 Google App Engine 上工作.但是,iPhone 版 Facebook 连接似乎仅通过 Facebook 的服务器对您进行身份验证,并允许您从 访问 Facebook Api.
I want to create an Iphone game where users can log in with their facebook credentials and authenticate with my server running on Google App Engine. I have gotten Facebook connect working on both the iPhone and Google App Engine. However, it seems that Facebook connect for the iPhone only authenticates you with Facebook's server and allows you to access the Facebook Api from .
我想这样做的原因是,我可以在 GAE 上存储与用户帐户关联的额外用户数据,同时让他们使用他们的 Facebook 凭据登录.
The reason I want to do this, is so that I can store extra user data associated with a user account on GAE, but also have them log in with their Facebook credentials.
是否可以使用 iPhone 本地客户端使用他们的 Facebook 凭据对用户进行身份验证,但通过我的服务器进行身份验证?iPhone 版的 Farmville 似乎做了类似的事情.
Is it possible to authenticate the user using their Facebook credentials using an iPhone native client, but authenticate with my server? It seems like Farmville for the iPhone does something like this.
任何想法如何做到这一点?
Any ideas how this is done?
推荐答案
这可以通过 GAE 应用上的中间 Facebook API 代理来实现.
This is possible via an intermediate Facebook API proxy on your GAE app.
浏览我的一些代码,我使用客户端提供的 auth_token
和 generate_session_secret
调用经典 API 的 auth.getSession
,当然 format
是 XML
.
Skimming through some code I have that does this, I call the classic API's auth.getSession
with auth_token
and generate_session_secret
provided by the client, and of course format
is XML
.
http://developers.facebook.com/docs/reference/rest/auth.getSession/
基本上发生的情况是客户端登录,获取身份验证令牌,将其发布到中间代理,然后使用该令牌向 Facebook 请求会话,将其返回给 Connect 客户端.
Essentially what happens is that the client logs in, gets an authentication token, posts that to the intermediate proxy which then asks Facebook for a session using that token, returning that to the Connect client.
这篇关于从 Iphone Native Client 使用 Google App Engine 进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!