Follow these steps to generate the token.pickle file on Android using Termux.
Download and install Termux.
Open Termux and run this command to update, install necessary packages, and set up Python:
pkg update && pkg upgrade -y && pkg install git python python-pip -y && python -m pip install --upgrade pip && pip install google-api-python-client google-auth-httplib2 google-auth-oauthlibFirst, Give Termux storage access:
termux-setup-storageNow nevigate to the Internal Storage:
cd /sdcardRun the following to clone the TokenPickle repository:
git clone https://github.com/rjriajul/TokenPickle
cd TokenPickleThen Move the credentials.json file to your phone’s internal storage.
cp /sdcard/credentials.json /data/data/com.termux/files/home/TokenPickleNavigate to the project folder and run the script:
python3 generate_token.pyCopy the URL displayed, open it in a browser, and log in to your Google account. After successful authentication, you’ll see the message:
“The authentication flow has completed. You may close this window.”
Copy the generated token to your phone's storage:
cp token.pickle /sdcardYou’ll find token.pickle in your phone’s internal storage.