Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Token expires after a short time #18

Closed
NoMore201 opened this issue Oct 19, 2017 · 8 comments
Closed

Token expires after a short time #18

NoMore201 opened this issue Oct 19, 2017 · 8 comments
Labels

Comments

@NoMore201
Copy link
Owner

NoMore201 commented Oct 19, 2017

After some time of "inactivity" during a session, google starts answering with empty responses like this:

>>> server.bulkDetails(['org.mozilla.focus'])
[{'docId': '', 'title': '', 'author': '', 'offer': [], 'images': [], 'versionCode': 0, 'installationSize': 0, 'numDownloads': '', 'uploadDate': '', 'files': [], 'unstable': False, 'containsAds': '', 'aggregateRating': {'type': 0, 'starRating': 0.0, 'ratingsCount': 0, 'oneStarRatings': 0, 'twoStarRatings': 0, 'threeStarRatings': 0, 'fourStarRatings': 0, 'fiveStarRatings': 0, 'commentCount': 0}, 'dependencies': [], 'category': {'appType': '', 'appCategory': ''}, 'detailsUrl': ''}]
>>> server.search('termux', 1)
Unexpected behaviour
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/nomore/workspace/nogoogle/googleplay-api/gpapi/googleplay.py", line 292, in search
    cluster = response.payload.listResponse.cluster[0]
IndexError: list index out of range

If you login again, API starts working again until another 5 minutes of inactivity. It seems like the token expires after a short time, but this is strange since auth tokens were thought to be valid for months. I'm quite sure it doesn't depend on gpapi code, but it is a google break.

Steps to reproduce issue:

  • Open a python interactive shell
  • Initialize object and login
from gpapi.googleplay import GooglePlayAPI
server = GooglePlayAPI()
server.login(EMAIL,  PASSWD, None, None)
  • Start playing around with the api, it should work without problems
  • Leave the shell open for some minutes without interaction (in my case 5 minutes was enough)
  • Try to execute another query

Let me know if you can reproduce this behaviour

@NoMore201 NoMore201 added the bug label Oct 19, 2017
@GoyfAscetic
Copy link

I can reproduce this behavior

@matlink
Copy link
Contributor

matlink commented Oct 27, 2017

Same here. I've written a little patch to get a new token in gplaycli.

@NoMore201
Copy link
Owner Author

Same, I added some code to playmaker to fetch a new token in case it's not valid anymore. I wonder if other projects are having the same issue.

@dizzy666
Copy link

dizzy666 commented Nov 1, 2017

I can reproduce this problem with latest playmaker. After a few minutes the logs get flooded

11:38.306581787Z Session tokens expired, re-login needed
11:38.834709205Z authSubToken: ...
11:39.223269093Z Session tokens expired, re-login needed
11:39.802276499Z authSubToken: ...
...
12:00.708673152Z Session tokens expired, re-login needed
12:01.038289746Z authSubToken: ...
12:01.296437585Z Session tokens expired, re-login needed
12:01.525255998Z Wrong credentials: 'server says: ServerError'
12:01.796446797Z Session tokens expired, re-login needed
12:02.003540987Z Wrong credentials: 'server says: ServerError'
...

@NoMore201
Copy link
Owner Author

@dizzy666 are you sure you're using the latest version? I fixed those problems some days ago, now it's working as intended (at least for me and a bunch of other people). I just uploaded the latest version on Docker Hub, be sure to docker pull nomore201/playmaker before running it.

@dizzy666
Copy link

dizzy666 commented Nov 1, 2017

@NoMore201 same error.

@dizzy666
Copy link

dizzy666 commented Nov 2, 2017

I have tried GooglePlayAPI in a Python shell.
server.login(None, None, gsfId, authSubToken)
and search works fine but after a few minutes search return a error (expired toke).
I try server.login again but it fails.

>>> server.search('telegram', 1, None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/gpapi/googleplay.py", line 268, in search
    raise LoginError('Unexpected behaviour, probably expired '
gpapi.googleplay.LoginError: 'Unexpected behaviour, probably expired token'
>>> server.login(None, None, gsfId, authSubToken)
authSubToken: ...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/gpapi/googleplay.py", line 185, in login
    self.search('firefox', 1, None)
  File "/usr/local/lib/python3.6/site-packages/gpapi/googleplay.py", line 268, in search
    raise LoginError('Unexpected behaviour, probably expired '
gpapi.googleplay.LoginError: 'Unexpected behaviour, probably expired token'
>>> server.search('telegram', 1, None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/gpapi/googleplay.py", line 268, in search
    raise LoginError('Unexpected behaviour, probably expired '
gpapi.googleplay.LoginError: 'Unexpected behaviour, probably expired token'

@NoMore201
Copy link
Owner Author

Here it is, once again @yeriomin has the answer to the problem. It seems related to the token TTL parameter, and a second auth request is needed.

yeriomin/play-store-api@6544937

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants