0

I'm having trouble integrating the Google Realtime API. It was working fine for a while, but then it started failing with "Drive Realtime API Error: token_refresh_required: The OAuth token must be refreshed." logged to the browser console when I call gapi.drive.realtime.load. My auth flow is based on https://developers.google.com/identity/protocols/OAuth2UserAgent#example, and it all appears to work fine when I'm not using Realtime.

The quickstart didn't mention anything about this. I tried looking at other example Realtime code, but it mostly came up as using gapi.auth instead of gapi.auth2. I slogged through a bunch of sites talking about kicking off a timer to occasionally call .signIn or other methods. Finally found one complete example to work from, but I completely don't follow its expiry checks and it seems to be receiving some data from Drive via the URI hash that I don't receive.

Any idea how to fix this? Or even background on what it means relative to gapi?

Matt Tsōnto
  • 1,518
  • 1
  • 15
  • 30
  • Have you try checking this so post https://stackoverflow.com/questions/17623682/google-drive-realtime-api-oauth2-refresh-errors?rq=1 ? – MαπμQμαπkγVπ.0 Sep 17 '17 at 13:18
  • Yeah. The first part was a bug that the answering dev fixed, and the second part was a different error. The rest of the discussion went over my head. – Matt Tsōnto Sep 18 '17 at 02:20
  • Possibly related to these: https://github.com/google/google-api-javascript-client/issues/287, https://github.com/googledrive/drive-music-player/pull/195 – Matt Tsōnto Sep 20 '17 at 16:56
  • I was using gapi.auth with the realtime api and everything worked fine. Then I saw that gapi.auth was no longer in the documentation so I switched to gapi.auth2. I immediately got token_refresh_required errors. I spent a week trying to figure out the problem. I ended up installing and using both gapi.auth and gapi.auth2. This is probably a bad idea, but it seems to work. Google needs to update Realtime for gapi.auth2. – RFF Oct 12 '17 at 15:22

0 Answers0