Facebook访问令牌由于未知原因到期 [英] Facebook access tokens expiring for unknown reason

查看:331
本文介绍了Facebook访问令牌由于未知原因到期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从@ avs099编辑:我正在开始这个帖子的赏金,因为我有完全相同的问题。我总结了这里的问题,并将帖子本身没有任何更改在底部作参考。

EDIT from @avs099: I'm starting the bounty on this post as I have exactly the same issue. I summarize the problem here, and leave the post itself without any changes at the bottom for the reference.

我们拥有: Facebook页面访问令牌,如下所述获取:验证为页面和通过新的 fb_exchange_token 请求,将该日期延长至60天。

What we have: Facebook page access token, obtained as described here: Authenticating as a Page and which live was extended to 60 days with new fb_exchange_token request.

有什么问题:这个标记可以工作一段时间 - 有时我可以在几天的时间内将数百张照片发布到我的粉丝页面;有时它几乎没有照片 - 然后我开始获取

What is the problem: this token works for some time - sometimes I can post hundreds of photos to my fan page in the period of several days; sometimes it's literally few photos - and then I start getting either


(OAuthException)使访问令牌无效:会话已经
因为用户更改了密码,因此无效。

(OAuthException) Error invalidating access token: The session has been invalidated because the user has changed the password.


(OAuthException)错误使访问令牌无效:Session不
匹配当前存储的会话。这可能是因为用户从创建会话后更改了
密码,或者由于安全原因,Facebook已将
更改为会话。

(OAuthException) Error invalidating access token: Session does not match current stored session. This may be because the user changed the password since the time the session was created or Facebook has changed the session for security reasons.

从Facebook的例外 - 但是当然我没有修改密码或者取消授权的应用程序。

exceptions from the Facebook - but of course I did not do change password or deauthorized the app.

其他信息:不确定是否重要,但是:

Additional information: Not sure if that matters but:


  1. 有时我在Facebook请求之后几天开始使用令牌

  2. 令牌是从服务器
    (位于不同于地理位置的桌面
    应用程序(请求将照片发送到粉丝页))的请求下载的。

  3. 有时候会发生几个不同的桌面应用程序发布来自不同电脑的照片(即我猜想不同的IP)

任何人都知道发生了什么,如何解决这个问题?

Anybody has a clue what's going on and how to resolve this?

谢谢。

我有一个Facebook应用程序提供两个目的:

I have a facebook app that serves two purposes:

1)允许用户与我的网站连接
2)允许我的网站发布到我的网站Facebook粉丝页面墙

1) Allows users to facebook connect with my site 2) Allows my site to post to my sites facebook fan page wall

我担心的是第二次使用。我以前能够在一个粉丝页面上设置一个应用程序的权限,以便允许发布(通过php sdk),而不用担心访问令牌。现在我创建了一些新的粉丝页面,该功能似乎已被删除。好的,所以我经历了为用户获得访问令牌(成功)的整个过程(总是我或我的Facebook粉丝页面的另一个管理员),并使用该令牌获取我管理的粉丝页面的访问令牌(我有manage_pages权限,因此我想要发布的页面的其他管理员)。然而,引擎会将内容发布到我的粉丝页面,令牌已过期,其中有两个错误消息之一:

What I'm concerned about is the 2nd usage. I used to be able to set the permissions for an app on a fan page to just allow posting (via the php sdk) without any concern about an access token. Now I've created some new fan pages and that functionality seems to have been removed. Alright, so I go through the whole process of getting an access token (successfully) for the user (always me or another admin of my facebook fan pages) and use that token to get the access tokens for the fan pages I manage (I have the manage_pages permission and so do the other admins for the pages I want to post to). However by the engine gets around to posting content to my fan pages the tokens have expired with one of two error messages:

错误使访问令牌无效:会话不匹配当前存储会话。这可能是因为用户在创建会话之后更改了密码,或者为了安全起见,Facebook更改了会话。

Error invalidating access token: Session does not match current stored session. This may be because the user changed the password since the time the session was created or Facebook has changed the session for security reasons.

OAuthException:使访问令牌无效:会话已被禁用,因为用户已更改密码。

OAuthException: Error invalidating access token: The session has been invalidated because the user has changed the password.

但这不是访问令牌依赖于外部用户,只有内部人(现在我和另外一个人)。我们没有改变我们的密码或做任何事情。我甚至通过在获取令牌后退出Facebook测试它,并且工作正常。只是稍后一段时间,我们无法确定是否到期。当我得到令牌时,我可以在调试工具上检查它们,并且它们应该持续60天(根据文档),尽管该工具表示它们永远不会过期。

But this isn't an access token dependent on outside users, only internal people (me and one other guy right now). We aren't changing our passwords or doing anything. I've even tested it by logging out of facebook after acquiring tokens and it works fine. It's just after a little while they expire for no reason that I can determine. When I get the tokens I can check them on the debugging tool and they are supposed to last 60 days (according to the doc) although the tool says they never expire.

我已经设置了系统,所以当没有发布到页面时,我收到一个电子邮件,链接到我的网站来更新令牌。

I've set up the system so when it fails to post to the page I get an email with the link to my site to update the tokens.

任何人都有一个线索发生了什么?

Anyone have a clue what's going on?

推荐答案

正如Mikhail指出的,如果您收到错误报告令牌无效,因为用户已更改密码。当您已经有一个有效的代码时,您会在代码中隐藏的位置请求一个新令牌。

As Mikhail pointed out, if you get an error reporting that the token is invalid cause user has changed the password. Odds are you are requesting a new token somewhere hidden in the code, when you already have a valid one.

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

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