yeriomin / play-store-api

Google Play Store protobuf API wrapper in java
GNU General Public License v3.0
324 stars 131 forks source link

Will TOKEN expire after some days? #24

Closed HungUnicorn closed 6 years ago

HungUnicorn commented 6 years ago

Hi,

I know GSFID will not expire, because it's used for two years and never changed in our code. Nevertheless, I found TOKEN is hard-coded in the test. https://github.com/yeriomin/play-store-api/blob/master/src/test/java/com/github/yeriomin/playstoreapi/GooglePlayAPITest.java#L16

In our code we reset TOKEN for each hour. Would it be necessary?

yeriomin commented 6 years ago

Hello.

Nevertheless, I found TOKEN is hard-coded in the test.

Not only the token is hard-coded, but the google responses too, see here. Those tests are unit tests, so their job is to test code, not detect api changes.

In our code we reset TOKEN for each hour. Would it be necessary?

I would suggest checking for 401 responses to api requests. 401 means the token is stale, so it is time to get a new one. Token lifetime is not long - hours at best.

HxBreak commented 6 years ago

if you don't get new TOKEN, the old TOKEN will not be expire.

yeriomin commented 6 years ago

@HxBreak It will. Later.

HxBreak commented 6 years ago

@yeriomin i have a spider the token worked for a long time.

yeriomin commented 6 years ago

@HxBreak It might depend on the device. Two-step token retrieval does not work for them for example.