Google Drive Realtime API OAuth2 Refresh Errors

[亡魂溺海] 提交于 2019-12-01 18:22:49

I took a look at your issue and I think you're correct about the two main issues.

  1. Refreshed tokens aren't automatically picked up by the API.
  2. Closing and reopening a document leads to periodic "Cannot read property 'o' of null" errors.

Regarding issue 1, we pick up a refreshed token any time a change is saved and also every second while the server to client connection is unhealthy (e.g. after a 401 error). What this obviously doesn't cover is the case where you refresh the token early and there isn't any change to the document. In this case, you'll see a 401 even though you already updated the token. I'm working on a fix for this issue that will pick up the refreshed token every 30 seconds while the connection is healthy. Ultimately we would like to have this be event driven so that the token is picked up immediately, but that is somewhat more involved because it will require changes to gapi.auth.

Regarding issue 2, based on my testing it appears that the periodic error is spurious (internally we're still trying to refresh the token for the old document even though the document has been closed, which is why you get the 'Cannot read property' error). I'm working on a fix for this as well, but you should still be able to reload the document (although you will see lots of garbage errors for the old document). Please let me know if this isn't the case and you really can't reload the document.

I should note that you should not need to reload the document when you get a token refresh error. This is indicated by the fact that the isFatal property of the gapi.drive.realtime.Error object passed to your error handler is false, which indicates that the error is recoverable. The suggested response for a token_refresh_required error is to refresh the token - the network service should catch up automatically. If that doesn't work, please feel free to let me know as it is a bug.

-- Brian (Realtime API Developer)

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