calibre-web icon indicating copy to clipboard operation
calibre-web copied to clipboard

Need assistance setting up Gmail oAuth

Open jasehigh opened this issue 4 months ago • 1 comments

I'm current moving my home server and setting up calibre-web in docker using Portainer.

My Portainer stack contains the environment option: - OAUTHLIB_RELAX_TOKEN_SCOPE=1

I have followed these instructions (https://github.com/janeczku/calibre-web/wiki/Setup-Mailserver#gmail) and have downloaded my credentials, renamed the file to gmail.json and have dropped this in my /config folder.

I then go to the container in portioner, select the console option and perform the following:

ps -C "python3 /app/calibre-web/cps.py" -o pid=
153
kill 153 && python3 /app/calibre-web/cps.py &
[1] 257

Calibre-web is set restarted and I login using admin and the default admin password. I select the location of my calibre database and finally goto "Edit Email Server Settings", select "Gmail Account" and click on the "Setup Gmail Account" button.

I then get the error message: Found no valid gmail.json file with OAuth information

The gmail.json file is in the /config folder alongside other files such as app.db. Is this the incorrect location?

Any assistance is greatly appreciated.

jasehigh avatar Mar 02 '24 12:03 jasehigh

I have made some progress with this. I have added the following into my docker compose file to expose the gmail.json file to calibre-web

    volumes:
      - type: bind
        source: /Volumes/data/docker/appdata/calibre-web/gmail.json
        target: /app/calibre-web/gmail.json

From the console to my docker container I perform the following:

ps -C "python3 /app/calibre-web/cps.py" -o pid=

This returns the PID that I then use in this command:

kill <pid> && python3 /app/calibre-web/cps.py

I then go back to calibre-web, and then have to login as the default "admin" user, as my user profile/settings have been removed. I select a the folder that contains my calibre database, and then click on the "Setup gmail account as email server" option.

I copy the URL from the docker console, paste this into my browser, and grant google access. Using the URL this gives me, I paste this into another docker console to my container:

curl "<URL>"

This returns the message "The authentication flow has completed. You may close this window.".

The calibre-web window also shows:

"Success! Gmail Account Verified." "Email Server Settings updated"

I then stop the container and restart. This allows me to log back in as my user. However, once logged back in, the email option is not set to gmail.

Any assistance is greatly appreciated.

jasehigh avatar Mar 29 '24 13:03 jasehigh