Closed TomasVCMU closed 2 years ago
@TomasVCMU I would first check the settings for the client that you are using:
specifically, in the Authorized redirect URIs
you should provide address of the server, including its port (8080 or 8090 - not sure). Something like: https://flpinventory.com:8080
.
Then you need to provide the same redirect_uri
in the settings.yaml
file (see this).
If this doesn't work please share the exception message / stack trace that you are getting?
Thanks! Can you expand on what I would change the redirect_uri to?
@shcheklein I tried this. Doesn't seem to be working still. Here are images of what I added as you instructed as well as my docker logs output.
@TomasVCMU one of the same https://flpinventory.com:8080
or https://flpinventory.com:8090
Btw - are using PyDrive or PyDrive2? PyDrive
is not maintained anymore and can have some old unresolved problems.
And please, don't pass anything to LocalWebserverAuth()
, you don't need it.
@shcheklein Oops, just noticed I was running an old version with pyDrive instead of pyDrive2. However, I just changed it and I also removed the host_name passed to LocalWebserverAuth(). Still no luck. Same Auth exception is raised.
Does the redirect_uri need to be path specific. The call is being made on flpinventory.com/report/ . Should I be making my redirect_uri on the Google Console and settings.yaml to be flpinventory.com:8080/report/ or is flpinventory.com:8080 fine? I'm not sure what could be going wrong here. Ports allowed on docker, ec2, and now redirect uri is fixed on Google Console + settings.yaml
Logs below:
Does the redirect_uri need to be path specific.
It should be exact URL that can be used to access that 8080 port in the container.
This error that you are getting means this:
"Failed to start a local web server. Please check your firewall"
)
print(
"settings and locally running programs that may be blocking or"
)
print("using configured ports. Default ports are 8080 and 8090.")
It might be that something is already running that takes 8080 and 8090? Another instance of this app? Review the way you map ports?
@shcheklein I can try to change the port to some arbitrary number, but I doubt we're using those ports at all considering I only recently allowed them in my EC2 admin panel. So, if it was the case that those ports were being used, then those wouldn't have gone through either way. The only mapping I'm using is for port 80 and port 443 using Caddy as a reverse proxy for Certbot for SSL certificates.
Should I then change the redirect_uri to be flpinventory.com:8080/report/ to make up for this?
First, I still see that it can't start the local HTTP server inside the container for whatever reason (logs are not good, PyDrive2 should be fixed to throw something more meaningful). What I would is to SSH into container and would try to run a simple HTTP server from the Python console on the same port - 8080, 8090:
import http.server
httpd = http.server.HTTPServer(('', 8080), None)
httpd.serve_forever()
You should be then able to access flpinventory.com:8080
(or it might depend on your setup you need to specify the report/
)
Should I then change the redirect_uri to be flpinventory.com:8080/report/ to make up for this?
I doubt. When you run flpinventory.com
does it access the same container?
I am struggling to get past an Authorization exception when running PyDrive to upload a CSV file for an inventory website I am hosting.
My code lives on an EC2 instance and runs with Docker. See https://github.com/AashaiAvadhani1/FLP-Inventory for our codebase. In the path
inventory/views.py
(https://github.com/AashaiAvadhani1/FLP-Inventory/blob/master/inventory/views.py
) I have a function that does the authorizationgoogle_auth()
. I get theAuthorizationException
when runninggauth.LocalWebserverAuth()
In the
docker-compose.yml
file, I have allowed ports 8080 and 8090 (Current file isn't updated, but an image is provided here of my file). Note: mysettings.yaml
file is not in this github for security purposes, but my program runs fine when I run the code locally - so it shouldn't be an issue with that. I have also updated my security group with inbound rules allowing these ports to no avail. Any help would be much appreciated.I have also tried changing the
host_name
field in the LocalWebserverAuth() to "flpinventory.com" since that is my website. This also does not work. Does PyDrive2, in its current implementation, simply not allow this to work on live websites? I can't find any documentation or examples online, either. Thanks.