1

I am trying to implement facebook SSO on my Android app. Once the user logs into the app using facebook he will make calls to my web service running on Google App Engine(GAE). Currently I am able to obtain the access_token from facebook on my android app. Then I add this access_token as a cookie to my http request to GAE . But I am not sure how would I authenticate the request from the user using the cookie, on GAE. Currently I am trying:-

User user = OAuthServiceFactory.getOAuthService().getCurrentUser();
String email = user.getEmail();

But my GAE web service is throwing this exception:-

org.restlet.resource.UniformResource doCatch: Exception or error caught in resource
com.google.appengine.api.oauth.InvalidOAuthParametersException

Is this the correct way of authenticating the user? If yes, then what am I missing here which is causing this exception.

Thank for the help!!

4

1 回答 1

1

这是失败的,因为您没有使用 OAuth。您正在获取 Facebook 连接身份验证令牌 - 它也不使用 OAuth - 并将其附加到您对 App Engine 应用程序发出的请求中。

如果您想在您的应用中使用 OAuth,则需要对您的 App Engine 应用进行身份验证。如果你想重用你的 Facebook 凭证,你将不得不使用 Facebook 提供的任何 API 来验证身份验证令牌(如果有的话),而不是 OAuth API。

于 2012-05-17T23:55:57.743 回答