gkeepapi icon indicating copy to clipboard operation
gkeepapi copied to clipboard

How to get master token

Open Ashna-git-hub opened this issue 1 year ago • 1 comments

I am unable to get the master token as it does not show the sequences listed when I log in

Ashna-git-hub avatar Sep 06 '24 12:09 Ashna-git-hub

Hi, It worked for me today using docker:

docker run --rm -it --entrypoint /bin/sh python:3.8 -c 'pip install gpsoauth; python3 -c '\''print(__import__("gpsoauth").exchange_token(input("Email: "), input("OAuth Token: "), input("Android ID: ")))'\'

To get the OAuth token, follow this steps : https://github.com/rukins/gpsoauth-java/blob/b74ebca999d0f5bd38a2eafe3c0d50be552f6385/README.md#second-way Leave Android ID blank

rubidev68 avatar Nov 27 '24 08:11 rubidev68

I was able to get it today using: https://github.com/leikoilja/ha-google-home?tab=readme-ov-file#master-token

adrianlzt avatar Jul 14 '25 16:07 adrianlzt

got the master token from

I was able to get it today using: https://github.com/leikoilja/ha-google-home?tab=readme-ov-file#master-token

but still getting Bad Auth error , can anyone tell me what i might have been doing wrong , i even tried the method recommended by the docs by generating an app password but that didnt worked as well , any suggestions?

Traceback (most recent call last):
  File "C:\Users\dell\keep to logseq\main.py", line 7, in <module>
    success = keep.authenticate("[email protected]", master_token)
  File "C:\Users\dell\AppData\Roaming\Python\Python313\site-packages\gkeepapi\__init__.py", line 746, in authenticate
    auth.load(email, master_token, device_id)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\dell\AppData\Roaming\Python\Python313\site-packages\gkeepapi\__init__.py", line 81, in load
    self.refresh()
    ~~~~~~~~~~~~^^
  File "C:\Users\dell\AppData\Roaming\Python\Python313\site-packages\gkeepapi\__init__.py", line 161, in refresh
    raise exception.LoginException(res.get("Error"))
gkeepapi.exception.LoginException: BadAuthentication

Bestboigill avatar Jul 17 '25 04:07 Bestboigill

@adrianlzt, were you able to successfully login using keep.authenticate()?
All I get is a BadAuthenticate error.

rajdeep-biswas avatar Jul 17 '25 04:07 rajdeep-biswas

❯ uv run --with gkeepapi python -c 'import os; import gkeepapi; keep = gkeepapi.Keep(); keep.authenticate("[email protected]", os.environ["GKEEP_MASTER_TOKEN"]); keep.sync(); print(f"Total notes: {len(keep.all())}")'
Total notes: 743

adrianlzt avatar Jul 17 '25 08:07 adrianlzt

@adrianlzt is there any way to determine what is it we are doing wrong , i have seen various ways of genrating master tokens here but all i get is bad auth

Bestboigill avatar Jul 17 '25 14:07 Bestboigill

I followed the link I posted before. Nothing special. It just worked

adrianlzt avatar Jul 17 '25 14:07 adrianlzt