Google Drive Realtime API OAuth2 Refresh Errors (Part 3)

谁说我不能喝 提交于 2019-12-01 06:05:10

问题


I'm having some issues with the realtime API reconnecting properly after a laptop/phone comes back from sleep/standby. The API properly detects that it needs to have a refresh OAuth token and throws an error, however once the token has been refreshed the realtime API does not correctly reconnect to the remote service. This is somewhat similar to (Part 2), however this only occurs after a couple hours of a lost connection.

I would expect that after the OAuth token is refresh, the realtime API would pick it up and resync itself with the remote server. Instead, it appears that the realtime API thinks it is in a valid state and makes modifications locally, but does not resync with the remote server.

// 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:"

Making edits to the realtime model works after the OAuth refresh, but the edits do not persist. Is this a valid scenario that the API supports? Is there any additional information I can give that would make identifying the problem easier?

来源:https://stackoverflow.com/questions/19415183/google-drive-realtime-api-oauth2-refresh-errors-part-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!