访问令牌有效,但我们收到OAuthException:活动访问令牌错误 [英] The Access Token is Valid but We get OAuthException: An active access token error

查看:166
本文介绍了访问令牌有效,但我们收到OAuthException:活动访问令牌错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经处理了大约2个月的应用程序,一切进展顺利。
,我们在登录权限中使用了PHP SDK和脱机模式
但是,由于几天前Facebook api最近发生更改并删除了脱机模式后,我们开始面临未捕获的OAuthException:必须有一个主动访问令牌的问题用于查询有关当前用户的信息。

We've been working on an application for about 2 months, and everything was going perfectly. we were using PHP SDK and offline mode in permissions for login But since some days ago after recent changes in Facebook api and removing offline mode we started facing the problem of "Uncaught OAuthException: An active access token must be used to query information about the current user."

主要问题是,它确实在我们的应用中工作了一段时间(大约10分钟)后发生,但同时我们通过< a href = https://developers.facebook.com/tools/debug/access_token rel = nofollow>此链接
我们看到令牌在cookie上仍然有效确实仍然存在并且不会过期,但是会出现此错误:
未捕获的OAuthException:必须使用活动访问令牌来查询有关当前用户的信息

The main problem is that it does happen after a while working in our app (about 10 mins) but at the same time when we check the validity of the token via this link we see that the token is still valid on the other hand the cookie does still exist and it doesn't expire but we get this error : "Uncaught OAuthException: An active access token must be used to query information about the current user"

我已经访问了此链接
,我下载了最新版本,但是这无济于事,没有人能帮助我们在哪里出错了?

I've already visited this link and I downloaded the latest version but it didn't help could anyone help us please where might be making mistake?

感谢您的回复,我认为与yacon
一样,访问facebook-> api时似乎存在错误(/ me)目前,我们正在使用javascript处理
应用程序的某些部分,而同时使用javascript sdk
和PhP sdk确实让人头疼

Thanks for responses, I think same as yacon it seems there's a bug when accessing facebook->api(/me) at the moment we are handling some parts of the app with javascript which is a real headache to use javascript sdk and PhP sdk alongside with each other

推荐答案

您可以解决此问题,只需在getLoginUrl之后存储对会话变量的访问令牌

You can solve this simply store accesstoken to session variable after getLoginUrl


$ facebook-> getLoginUrl(...)

$facebook->getLoginUrl(...)

然后无论何时初始化facebook

then whenever you initialize facebook


$facebook = new Facebook(array(
  'appId' => Yii::app()->params['facebook_appId'],
  'secret' => Yii::app()->params['facebook_appSecret'],
));

从会话中获取访问令牌并使用setAccessToken进行设置

get the accesstoken from session and set it using setAccessToken


$ facebook-> setAccessToken(Yii :: app()-> session ['access_token']);

$facebook->setAccessToken(Yii::app()->session['access_token']);

这篇关于访问令牌有效,但我们收到OAuthException:活动访问令牌错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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