genie-toolkit icon indicating copy to clipboard operation
genie-toolkit copied to clipboard

New refresh tokens are not stored correctly when using cloud sync

Open gcampax opened this issue 2 years ago • 4 comments

Not sure where the bug really is, so filing it here and then we'll find the right place.

Currently, tests for thingpedia-common-devices in Travis fail intermittently in Spotify, because API calls fail with "Refresh token revoked". A bit of investigation reveals that PKCE-enabled refresh tokens are single use only, and we need to store the new token when we get one. Something, somewhere, is failing to store the new token.

gcampax avatar Jul 15 '21 04:07 gcampax

@jmhw0123 think this might have something to do with the failure you were seeing on Travis?

nrser avatar Aug 10 '21 02:08 nrser

@jmhw0123 think this might have something to do with the failure you were seeing on Travis?

Yeah. I think it's probably one of the reasons.

jmhw0123 avatar Aug 10 '21 02:08 jmhw0123

Ok I bumped it up to P1, Spotify skill is one of our focuses and we're writing and running automated tests -- random failures undermine that.

@gcampax any idea what it may take to address this?

nrser avatar Aug 10 '21 02:08 nrser

We need to investigate exactly where the sync goes wrong (could be in the cloud, could be in the client), and then fix that. The main issue is that the sync connection might drop before the client had a chance to upload the new refresh token to the cloud, in which case we never store the new refresh token. Next time we run the tests, we fetch the invalidated refresh token again and die. We might be able to force the scenario tests to sync with the cloud before it closes.

The other issue is that both unit tests and scenario tests run concurrently. If both refresh at the same time we'll get in trouble.

gcampax avatar Aug 10 '21 02:08 gcampax