在笔记本电脑/手机从睡眠/待机状态恢复后,我在实时 API 重新连接时遇到了一些问题。API 正确检测到它需要刷新 OAuth 令牌并引发错误,但是一旦刷新令牌,实时 API 就无法正确重新连接到远程服务。这有点类似于(Part 2),但是这只发生在连接丢失几个小时后。
我希望在刷新 OAuth 令牌后,实时 API 会拾取它并与远程服务器重新同步。相反,实时 API 似乎认为它处于有效状态并在本地进行修改,但不会与远程服务器重新同步。
// Valid Auth Token
Object {state: "", access_token: "ya29.AHES6ZS38RR9kVX-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", token_type: "Bearer", expires_in: "3600", client_id: "XXXXXXXXXXXXXXX.apps.googleusercontent.com"…}
_aa: "1"
access_token: "ya29.AHES6ZS38RR9kVX-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
client_id: "XXXXXXXXXXXXXXX.apps.googleusercontent.com"
cookie_policy: undefined
expires_at: "1381916402"
expires_in: "3600"
g_user_cookie_policy: undefined
issued_at: "1381912802"
response_type: "token"
scope: Array[3]
state: ""
token_type: "Bearer"
// Current Time
Date.now()
1381912845180 [Wed Oct 16 2013 01:40:45 GMT-0700 (Pacific Daylight Time)]
// <<Computer Sleep For Hours>>
Uncaught Error: Authentication error: No token set api:462
Drive Realtime API Error: token_refresh_required: The OAuth token must be refreshed. api:464
Doc Load Error: Rw {type: "token_refresh_required", message: "The OAuth token must be refreshed.", b: false, isFatal: false}
// <<Refresh OAuth Token>>
// Current Time
Date.now()
1381959164975 [Wed Oct 16 2013 14:32:44 GMT-0700 (Pacific Daylight Time)]
// Valid Auth Token
Object {state: "", access_token: "ya29.AHES6ZRkwocCBwxj_h7Zx2_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", token_type: "Bearer", expires_in: "3600", client_id: "XXXXXXXXXXXXXXX.apps.googleusercontent.com"…}
_aa: "1"
access_token: "ya29.AHES6ZRkwocCBwxj_h7Zx2_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
client_id: "XXXXXXXXXXXXXXX.apps.googleusercontent.com"
cookie_policy: undefined
expires_at: "1381962143"
expires_in: "3600"
g_user_cookie_policy: undefined
issued_at: "1381958543"
response_type: "token"
scope: Array[3]
state: ""
token_type: "Bearer"
// Current Value
LOCAL.data.get("t")
"0.502 Beta 3:"
// Editing Value
LOCAL.data.set("t", "0.502 Beta 4:")
Mm {a: ""0.502 Beta 3:"", Ma: Object, K: function, oa: function, J: function…}
// Edit "Worked"
LOCAL.data.get("t")
"0.502 Beta 4:"
// <<Refresh Page>>
// Current Value
LOCAL.data.get("t")
"0.502 Beta 3:"
在 OAuth 刷新后可以对实时模型进行编辑,但编辑不会持续存在。这是 API 支持的有效场景吗?是否有任何其他信息可以让我更容易地识别问题?