tybug / ossapi

The definitive python wrapper for the osu! api.
https://tybug.github.io/ossapi/
GNU Affero General Public License v3.0
80 stars 17 forks source link

authorization doesn't work on Amazon Linux #72

Open ibuergis opened 1 year ago

ibuergis commented 1 year ago

I am currently trying to host my bot on an aws server and when the osu website is trying to send the data to localhost. It is telling me that the connection is getting refused. I made sure that both osu and my program have the same localhost ports.

I did look a bit into it and it should be possible to create a webserver on localhost so I dont understand why it doesnt work.

censorship on point (censorship on point)

to view the website I am using elinks.

For python I am using 3.10

I installed these packages into my instance via yum: xz-devel lzma zlib-devel gcc openssl-devel bzip2-devel libffi-devel make elinks

and I installed these libraries into my python: discord pycord ossapi pillow sqlalchemy pymysql

Stedoss commented 1 year ago

That request suggests that you are trying to use port 80 for the callback, which most likely won't work due to how linux port binding works (ossapi spins up its own server to accept the token callback). Try a port above 1024, which should be linux user bindable.

ibuergis commented 1 year ago

image I now tried it with the example port and several other ports but I still get the same result. I also made sure to update the information in the code and on osu accordingly

tybug commented 1 year ago

I'm not entirely sure how remoting into an aws server works or how you are accessing the webpage , so it's hard for me to offer specific advice. But maybe it will help you debug if I describe the flow ossapi goes through:

This process could be failing at a few places here. It may be up to you to determine which step, or provide more info.

tybug commented 1 year ago

I'm going to close this for now, but feel free to comment with more information and I'll try to help as best I can! Who knows - we might have a real bug here, or something ossapi can do better.

ibuergis commented 11 months ago

So I looked into it again and Ive tried two things:

I created a new instance with windows using the same security rules. I started a webserver myself on the port to see if I can even open and access the webserver using the port.

First the windows one surprisingly works fine which is good and does proof that my aws settings should support opening ports.

The webserver that I started also worked fine and I had full access on it.

It does seem like that the way ossapi opens the socket isnt compatible with amazon linux for some reason.

I ran the webserver with this command: "python3 -m http.server 3914 --directory ~/folder".

tybug commented 11 months ago

Thanks for the update.

I wonder if changing ossapi to use serversocket.bind(("127.0.0.1", port)) instead of serversocket.bind(("localhost", port)) would make a difference here.

ibuergis commented 11 months ago

it doesnt hurt to try...