-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Attempting to use Gmail Account with oAuth Verification causes Calibre-Web to become unresponsive #2254
Comments
This is a problem in the docker container. The gmail authentification workflow is supposed to open a random port, an start a server there for receiving the gmail answer, this doesn't work in the container (is block and not forseable as it's a random port) |
So want to claim that I am not an expert here, just trying to explore other ideas to get this to work. There are also alternatives for oAuth flows: It seems like other developers are able to work around this from within the a docker container. This doesn't seem like a blocker or technical limitation due to using containers. In google's oauth doc: https://developers.google.com/identity/protocols/oauth2/web-server#python_1 Unless I am looking at the wrong file, is this the location where you are specifying the random port? In which case, you could easily make this a static port - or if running in a container environment, specify a static port: If I look at the guide doc here: It seems like the port isn't random, you can specify a specific port to run the auth on. I do see this: Which describes what you are referring to. That would be a way to possibly run the output to stdout/stderr, which would show in the Docker containers logs. However, it also looks like this potential limitation was resolved last year. |
So I was in a similar boat as @delize and I think I figured out a (very convoluted) workaround. In my case, I'm running from a TrueNAS FreeBSD jail, but the symptoms of the problem were identical. My first clue came from noticing the text of a Google login page had been recorded in the nohup.out file. That's when I realized the server itself was trying to complete the authentication. So, assuming you're running from an environment where you don't have (or want) a GUI and therefore don't have a graphical browser, here's how I got it to work. Note that you WILL need some sort of browser, text-based is fine. My jail had w3m available and working by default, so that's what I used.
I'd be curious if this method works for anyone else that has a similar problem. I think what I've done here is more or less invented a bastardized version of the run_console strategy found here: https://google-auth-oauthlib.readthedocs.io/en/latest/reference/google_auth_oauthlib.flow.html by subverting the run_local_server strategy that is currently used in calibre-web. Not sure if it would be worth it to someone to look into adding official support for a run_console strategy or not. |
Kudos @kryndis , that helped a lot. Steps I followed were similar to yours but I don't have an browser, I managed just to use CURL for it and worked:
|
Is there a working solution for us running the docker-container version? I can't understand @kryndis steps above (how i would run the python command, in the foreground, within a docker container) |
@henkisdabro Here is what I did to get my docker container working:
Hope it helps. |
Thanks @Orgjvr very much for the detailed steps and full commands, so helpful for us newbies! This worked really well and email sending is now working! |
Can confirm that this is a solution to the original issue. :) Really appreciate everyone coming together here to help us on Docker. :) |
Really helpful @Orgjvr thank you! Only thing I found to do differently is for step 4, use the command
So you can keep the same shell while still getting terminal output and do the full authentication flow without opening another shell into the docker container, seemed to make it a lot smoother for me. Thanks again! |
@Orgjvr thank you so much for the help. |
Thx guys for the great job ... BUT : on step 4, application keeps on restarting by itself (port 8083 is already in use ...). Terminla won't show realtime output. Any idea ? |
So make sure you are not running two different commands for If you run those two commands separately s6-supervise will restart it in the linuxserver.io container before you can manually restart it. |
Thanks for the quick reply but it is the way I've done it ... but still nothing comes out into the terminal with regards to steps 5 & 6 Log is showing :
|
Same issue is occurring for me even if using the build from around the time the original solution was posted. I don't know if this helps narrow down the problem but I am running this on arm64 (raspberry pi). |
Sorry to insist but any help is more than welcome. My system is docker with calibre-web latest image. When open, the terminal will show nothing on calibre-web gmail provider information button press. All processes on google side are done. Last but not least, before all this, clicking the Oauth2 button was not freezing the application, but pressing the button below ("configuration of gmail account for mail server") fails and says : "no valid gmail.json files with Oauth information found"). Hope this helps a bit further ... Help is appreciated here ... |
@dr400 I think you might have an error in step 2. Either the volume was not added correctly to the docker container, or the files does not exists in the mounted path. Take note that in step 2 the parameters to the -v are 2 paths which are separated by a colon. The first one needs to be the same as in step 2, while the second path needs to point to the file on your host system. In other words, you need to be able to do "ls /app/calibre-web/gmail.json" inside the docker container, and also need to be able to "ls /mnt/user/appdata/calibre-web/gmail.json" outside your container on the host system. This second path might be different for you. It would depend on where you saved the gmail.json file. Just make sure that you use the path where you saved your file, as the path after the colon in step 2. Hope it helps. |
Hi Orgjvr and thanks for helping. Here below is the docker command I use : docker run --name=calibre-web1 -e PUID=1026 -e PGID=100 -e TZ=Europe/Paris -e DOCKER_MODS=linuxserver/calibre-web:calibre -e OAUTHLIB_RELAX_TOKEN_SCOPE=1 -p 8081:8083 -v /volume1/docker/calibre-web:/config -v /volume1/docker/calibre/Calibre_Library/Calibre_Library:/books -v /volume1/docker/Localtime/localtime:/etc/localtime -v /volume1/docker/calibre-web/gmail.json:/mnt/user/appdata/calibre-web/gmail.json --restart unless-stopped lscr.io/linuxserver/calibre-web:latest Mount is correct. Both ways are available. |
I now know what was wrong ... path is not the correct one for my settings (docker run behind a synology server). gmail.json as to be copied into /app/calibre-web/ and not the mnt/user/appdata/calibre-web/ folder ... Thanks Orgjvr for pointing me in the right heading ! |
The problem that I am having now is that with the linuxserver.io container, every week or so the access stops working and the books fail to send. I have to redo the entire process and then the send feature begins working for a time. Has anyone else experienced this problem? If so, have you found a fix? |
I experienced this as well and am hoping that I've fixed it by "publishing" my google cloud application. By default, applications that are in the "testing" state only have valid credentials for 7 days. You can "publish" without verifying, you'll just get an extra warning screen in the OAuth flow. Hopefully I'll remember to update this post if it works or not in a week. |
Thanks so much for the response. I just published and set up auth again based on your advice. Fingers crossed it solves the issue. It seems we can't be the only ones having this problem. |
I've run into a new issue on this one - previously the instructions by Orgjvr worked just fine and got me up and running. I ran into the same one week expiration that Plaidstallion and IHSten had, but now when I try to reauthorize the google oauth page gives me the following error: I've added "http://localhost" to my allowed redirect URIs, but no that's not working either. Anyone have a similar issue and able to get around it? |
Thanks, it worked for me. I've calibre-web installed in a Raspberry and had the same problem. I only had to change the cps route. |
Thanks! Worked perfectly for me. |
Just as an FYI, on the linuxserver.io docker image I had to do: |
Also, I recently found out you can use app codes with gmail to achieve the same functionality we had with simple auth before. After setting up a 2FA device one time it will give you essentially a username and password to send emails from the account with. https://ugtechmag.com/enable-basic-authentication-gmail-account/ |
Interesting, ok. I guess as I have mail send working with Google OAuth, I won't mess with it. I was able to use app codes for other services but it seems not to be an option here. Thanks for the info. |
Actually, that's what I did in the end.
After my "temp" OAuth expired, I wasn't able to get it to work again with a regenerated token, so I replaced it with SMTP using the app code.
Been working fine, so I'm not touching it.
Sent from Proton Mail mobile
…-------- Original Message --------
On May 24, 2023, 5:21 AM, CultusMechanicus wrote:
> Also, I recently found out you can use app codes with gmail to achieve the same functionality we had with simple auth before. After setting up a 2FA device one time it will give you essentially a username and password to send emails from the account with.
>
> https://ugtechmag.com/enable-basic-authentication-gmail-account/
>
> https://support.google.com/mail/answer/185833?hl=en
I couldn't get that to work, I set up an app password and set the server as smtp.gmail.com, TLS, port 527 etc but email tasks just ran forever and never set anything. They didn't out right fail, but they didn't work either.
—
Reply to this email directly, [view it on GitHub](#2254 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AW4FGJKBV2BQXANY6FEPJGDXHXHKHANCNFSM5LIDLRZA).
You are receiving this because you commented.Message ID: ***@***.***>
|
@DarrenYOW same issues i'm having - what SMTP service do you use? I'd prefer to move off the gmail token anyway it's a hassle |
It's a bit of a pain to setup but I use AmazonSES for some other services that didn't have options for oath. |
I'm using Gmail, as I already had the app password/token set up for other containers. Not ideal, but it is working for now. I don't anticipate hitting the send/attachment limit. Added to the "sh#t I gotta fix later" pile.
Sent from Proton Mail mobile
…-------- Original Message --------
On May 24, 2023, 7:53 PM, Frizat wrote:
***@***.***(https://github.com/DarrenYOW) same issues i'm having - what SMTP service do you use? I'd prefer to move off the gmail token anyway it's a hassle
—
Reply to this email directly, [view it on GitHub](#2254 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AW4FGJIF7MBV6P3S4P33BCTXH2NPZANCNFSM5LIDLRZA).
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
I have the gmail.json placed at /app/calibre-web/gmail.json. I updated my copy of gmail.py to return the full path of the gmail.json file being requested and found it was looking for it at: So perhaps this comment may help someone else trying to configure this and failing. |
-- FIXED --
What am I missing? I missed the last step
Working now (at least for now) |
Can confirm this works, as long as the gmail.json is in /config, rather than /mnt/... |
Folks, after pulling my hair out a bit trying to get this set up, I gave up and fiddled around with some App Specific Password settings and got it working OK. There was an issue with the security settings that may have been stopping some folks.
Here's the sending success: Perhaps folks can enlighten me as to why I shouldn't do it this way, but the set up is a helluva lot easier! |
hey guys i was and still am having an issue with calibre web saying it found no valid gmail.json file with oauth information. i have followed all of the steps for setting up a mail server including the docker steps. i also have the oauth file from google downloaded and bound (at least I'm pretty sure its bound, I'm using portainer to manage my containers) to /app/calibre-web/gmail.json. |
Not to harp on about it but try the app-specific approach I outlined above. Much simpler and is working on my setup. |
On google OAuth app type should be Desktop app not web server . Change that and it should work |
Has this process been improved at all? Google has mentioned that they are deprecating several methods of email that do not use oAuth - so oAuth is going to be a preferred route in the future, and as I am setting this up again from scratch - this is becoming a struggle with the latest image and the most recent oAuth instructions found in this issue. |
there is no process for ozzie to improve, it works fine per his standard instructions outside of a container. That said, the instructions are pretty close to perfect, the only note is that you must do what was stated here #2254 (comment) otherwise, calibre-web will load the default database which is not the correct database in our container. I am considering doing a symlink or something to keep those databases the same, as it would also reduce the number of support requests for password resets, but I will have to find time to do so.
|
This did the trick for me. Thank you. |
I tried following steps from @Orgjvr but encountered error on step 7.5. After I run Here's my step to reproduce:
|
It‘s a docker only problem |
Following the steps here and got "could not locate runnable browser " in the calibre-web UI and no links in the terminal which I ran the Any idea why this is happening? |
I am getting the same error using linux.io server docker image |
Same problem for me using linux.io image |
I have been looking for hours now, same errors and I'm not getting the link. |
Same issue here, would love to reopen this as it seems to be a regression or something. |
I also got "could not locate runnable browser" and worked around it with |
Hey all - just went through the docker setup myself and got it working (thanks to all in this thread!) and wanted to share a simple clear way to get going I set up a browser intercept so we don't need to install lynx (which has some issues with JS in the google auth flow) - this will just print the url you need to open directly
|
You are the real MVP, this worked brilliantly |
I spent hours trying everything under the Sun. Was sure I'm doing everything correctly, and yet kept on getting the "could not locate runnable browser" error. I should have just read all the way to the end first. This solution is the only one that worked. Thank you! |
Describe the bug/problem
Calibre-Web interface stops responding when navigating to https://domain/calibre-web/admin/mailsettings when attempting to use Google oAuth interface.
To Reproduce
Steps to reproduce the behavior:
Standard E-mail account
toGmail account with oAuth
Setup Gmail Account as E-Mail Server
Logfile
This is with debug context started:
Expected behavior
Open up Google oAuth flow to validate the Service Account
Environment (please complete the following information):
Additional context
#2179 - Seems related to the issue
I have attempted to clear the app.db file and start from scratch - this does not seem to help resolve the issue.
The text was updated successfully, but these errors were encountered: