续订身份验证令牌但无法保存。现在怎么办?

时间:2014-10-04 17:54:43

标签: intuit-partner-platform

要求续订即将过期的身份验证令牌。得到了新的令牌,但由于bug,应用程序无法保存它。现在不能请求新的,因为旧的被认为已过期。有什么追索权可用?

2 个答案:

答案 0 :(得分:2)

看看:https://developers.facebook.com/docs/facebook-login/access-tokens

另外, 取自:https://developers.facebook.com/blog/post/2011/05/13/how-to--handle-expired-access-tokens/

  • 令牌在到期时间后到期(默认为2小时)。
  • 用户更改了密码,使访问令牌无效。
  • 用户取消对您应用的授权。
  • 用户退出Facebook。

    令牌在到期后到期

此方案指的是用户过去已授权您的应用的用例,但您发出的访问令牌已过期。当您尝试代表她进行Graph API调用时,您将获得一个HTTP 400身体中出现以下错误:

  { 
      error: {
        type: "OAuthException",
        message: "Session has expired at unix time 
          SOME_TIME. The current unix time is SOME_TIME.”
      }, 
    } 

场景2:用户更改密码

This scenario refers to use case where a user has authorized your app in the past and then she changes the password associated with her Facebook account. In this scenario, when you try to make Graph API call on her behalf you will get an HTTP 400 with the following error in the body:

{ 
  error: {
    type: "OAuthException",
    message: "The session has been invalidated because 
      the user has changed the password.",
  }, 
}

Please note that you will receive this message even if your app was granted the offline_access permission if the user changed their password.

场景3:用户取消对您应用的授权

This scenario refers to a use case where a user has authorized your app in the past, but then she de-authorizes your app by going to the App Dashboard. In this scenario when you try to make a Graph API call on her behalf you will get a HTTP 400 with the following error in the body:

{
  error: {
    type: "OAuthException",
    message: "Error validating access token: USER_ID
      has not authorized application APP_ID",
  },
}

Please note that even if the user had authorized your app with the offline_access permission access tokens will become invalid if the user de-authorizes your app.

场景4:用户退出Facebook

此方案指的是用户过去授权您的应用然后退出Facebook的用例。如果用户使用offline_access权限授权您的应用,则Graph API调用将按预期工作。如果用户未授予此权限,并且您尝试代表用户进行Graph API调用,则会在正文中收到HTTP 400,并显示以下错误:

{
  "error": {
    "type":"OAuthException","message":"Error validating 
      access token: The session is invalid because the 
      user logged out."
   }
}

答案 1 :(得分:2)

这里唯一的办法是让最终用户断开他们的应用程序,然后重新连接。