Facebook的访问令牌不能延长 [英] Facebook access token can not be extended

查看:232
本文介绍了Facebook的访问令牌不能延长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Facebook的Andr​​oid SDK中,这是我刚刚从github上下载。

i am using the facebook android sdk, which i just downloaded from github.

据我了解,访问令牌仅适用于一个非常有限的时间,需要每一个应用程序被启动如文档中描述的时间延长。 https://developers.facebook.com/docs/mobile/android/build/ #extend_token

i understand that the access token is just valid for a very limited time and needs to be extended every time the app gets started as described in the doc. https://developers.facebook.com/docs/mobile/android/build/#extend_token

有2个问题与此:
1)函数extendAccessTokenIfNeeded()不更新当令牌已过期(只是一两个小时之后!)

there are 2 problems with this:
1) the function extendAccessTokenIfNeeded() does not update when the token has already expired (after just one or two hours!)

2)的其他问题,当我绕过第一个,是用于扩展该令牌所需的意图不能找到

2) the other problem, when i bypass the first one, is that the required intent for extending the token can not be found.

从SDK源:

Intent intent = new Intent();
intent.setClassName("com.facebook.katana",
                    "com.facebook.katana.platform.TokenRefreshService");
...
ResolveInfo resolveInfo =
            context.getPackageManager().resolveActivity(intent, 0);
if (resolveInfo == null) {
        return false;
}

resoveInfo是百达空在这里。

resoveInfo is allways null here.

在如何扩展标记任何想法?我不想调用authenticate()函数的所有toked到期的时间。这将彻底粉碎了用户体验!

any ideas on how to extend the token? i don't wanna call the authenticate() function all the time the toked expires. that would totally destroy the user experience!

THX 西蒙

推荐答案

Facebook的Andr​​oid SDK中作出刷新令牌服务的连接,延长访问令牌,但服务是Facebook的Andr​​oid应用程序,这意味着您的应用程序的一部分用户需要先安装原生的Facebook。

The facebook android sdk make a connection to the refresh token service to extend the access token, but the service is part of Facebook android app, which means that your app user needs to install native Facebook first.

另一种方法:

  1. 您可以使用图形API /认证/ access_token描述 developers.facebook.com/docs/offline-access-de$p$pcation /

  1. You can use graph api /auth/access_token described in developers.facebook.com/docs/offline-access-deprecation/

我试图从Facebook的iOS SDK的要求和它的作品:

I try the request from facebook iOS SDK and it works:

GET api.facebook.com/method/auth.extendSSOAccessToken?access_token =

GET api.facebook.com/method/auth.extendSSOAccessToken?access_token=

或JSON格式。 GET api.facebook.com/method/auth.extendSSOAccessToken?format=json&access_token =

or in json format. GET api.facebook.com/method/auth.extendSSOAccessToken?format=json&access_token=

请preFIX的https://上面所有的网址

Please prefix https:// to all the urls above.

这篇关于Facebook的访问令牌不能延长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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