如何避免已授权在Android的Facebook的SDK [英] How to avoid already-authorized in Android Facebook SDK

查看:215
本文介绍了如何避免已授权在Android的Facebook的SDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到一个完全无用的页面,当我使用单点登录的Facebook的Andr​​oid SDK中。

I'm getting a completely useless page when I use the Single Sign on for Facebook's Android SDK.

你已经授权happyapp。   preSS好继续。

"You have already authorized happyapp. Press "Okay" to continue.

本页面会破坏用户体验。如何赫克我摆脱它。很多人已经看到这一点,但没有解决方案发布。

This page would destroy user experience. How the heck do I get rid of it. Lots of people have been seeing this, but no solution is posted.

即使Facebook的承认,这是一个问题,请参见:<一href="http://forum.developers.facebook.net/viewtopic.php?id=84548">http://forum.developers.facebook.net/viewtopic.php?id=84548

Even Facebook admits this is a problem, see: http://forum.developers.facebook.net/viewtopic.php?id=84548

有谁知道任何变通办法?

Does anyone know any work-around?

推荐答案

我做的(无需额外的OAuth的解决方案)是储存关在preferences访问令牌Kieveli建议的方式。当主活动开始,看看从preferences的道理,如果它不存在启动批准程序,并存储在preferences所产生的令牌。

The way I did it (without additional OAuth solution) was to store off the access token in preferences as Kieveli suggested. When the main activity starts, look up the token from preferences, if it's not there initiate the authorization process and store the resulting token in preferences.

比较困难的部分是处理令牌到期或您的应用程序的取消授权(即令牌处于preferences,但不再有效)。

The harder part is to handle token expiration or de-authorization of your app (ie. the token is in preferences, but is no longer valid).

有关这种情况下,与每一个FB API /图调用,检查失败的异常,指示认证。如果失败,重新启动授权/令牌存储步骤。

For that case, with every FB API/graph invocation, check for an exception indicating authentication failed. If it fails, initiate the authorization/token storing procedure again.

这篇关于如何避免已授权在Android的Facebook的SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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