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

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

问题描述

当我使用单一登录Facebook的Android SDK时,我正在获得一个完全无用的页面。


您已经授权了happyapp
按Okay继续。


< blockquote>

这个页面会破坏用户体验,我该如何解决它,很多人都看到这个,但没有解决方案。



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



有没有人知道任何工作?

解决方案

我做的方式(没有额外的OAuth解决方案)是按照Kieveli的建议,在首选项中存储访问令牌,当主要活动开始,从首选项中查找令牌,如果它不在那里启动授权过程并将所得到的令牌存储在首选项中。



更难的部分是处理令牌到期或解除授权你的应用程序(即t他的令牌处于首选项,但不再有效)。



对于这种情况,对于每个FB API /图表调用,请检查指示身份验证失败的异常。如果失败,请再次启动授权/令牌存储过程。


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

"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.

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

Does anyone know any work-around?

解决方案

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.

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).

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 SDK SDK中已经授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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