无效的访问令牌 - 图 Api 与 R

Invalid acces token - Graph Api with R

直到一个月前,我一直在使用 Rfacebook 库,没有任何问题。当我加载生成的令牌时,我想使用一些函数,例如

getUsers("me",fb_oauth) #fb_oauth is my token

它给我以下错误:

Error in callAPI(url = url, token = token) : 
  Error validating access token: Session has expired on Tuesday, 04-Apr-17 13:24:59 PDT. The current time is Tuesday, 02-May-17 06:33:21 PDT.

为了尝试解决这个问题,我在应用程序中生成了一个新密码并生成了一个新令牌,我正确地获得了新令牌:

fb_oauth <- fbOAuth(app_id="12345678", app_secret="xxxx")

Copy and paste into Site URL on Facebook App Settings: http://localhost:1410/ 
When done, press any key to continue...
Waiting for authentication in browser...
Press Esc/Ctrl + C to abort
Authentication complete.

但是当我想使用相同的函数时却报错

Error in callAPI(url = url, token = token) : 
  An access token is required to request this resource.

Also configure the login in the app but it does not work either 有人知道如何使用新的 2.9 更新生成新令牌吗?

此致

正如 CBroe 提到的,访问令牌 return 格式已更改,因此问题似乎是,使用 facebook 授权时 returned 的凭据(包括访问令牌)保存为字段 name/key 而不是字段值。

因此,解决此问题的方法如下:

fb_oauth <- fbOAuth(app_id, app_secret, extended_permissions = FALSE,legacy_permissions = FALSE) 

fb_oauth_credentials <- fromJSON(names(fb_oauth$credentials))

然后进行请求,比如获取页面;

fb_page <- getPage(page = "FBUserNameHere",
                   token = fb_oauth_credentials$access_token)