SQLMatches/API

Can't get API to create sessions for steam login.

Closed this issue · 11 comments

Hi,
I was trying to self-host this app.
I set up the API and built the frontend. I also set up the Nginx reverse-proxy configs. I am not using the UNIX domain sockets, instead, I am serving the API on port 8000. I tested this both in a development env as well as the production.
However, I just can't log in to the website with steam. All I am seeing on the output is this:

ujson module not found, using json
Using local storage for demos, use b2 for production.
INFO:     Started server process [15223]
INFO:     Waiting for application startup.
Memory cache being used, use redis for production.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     ('127.0.0.1', 42128) - "WebSocket /ws/socket.io/" [accepted]
INFO:     ('127.0.0.1', 42318) - "WebSocket /ws/socket.io/" [accepted]
INFO:     [myclientiphere]:0 - "GET /api/community/ HTTP/1.0" 403 Forbidden
INFO:     [myclientiphere]:0 - "GET /api/steam/login?return=/ HTTP/1.0" 307 Temporary Redirect
INFO:     [myclientiphere]:0 - "GET /api/steam/validate?return=/ [ Bunch of openid stuff here] HTTP/1.0" 307 Temporary Redirect
INFO:     ('127.0.0.1', 42388) - "WebSocket /ws/socket.io/" [accepted]
INFO:     [myclientiphere]:0 - "GET /api/community/ HTTP/1.0" 403 Forbidden

I redacted some info that I think might be personal from logs with comments inside brackets.

Now I think that this has something to do with sessions but don't know where to look.
Any help is appreciated.

what's your nginx config?

Like this:

server {
    listen 80;
    client_max_body_size 4G;

    server_name match.mydomainhere.com;

    location /api {
      proxy_pass http://backend;
      proxy_set_header Host $http_host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_redirect off;
      proxy_buffering off;
    }

    location /webhook {
      proxy_pass http://backend;
      proxy_set_header Host $http_host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_redirect off;
      proxy_buffering off;
    }

    location /ws {
      proxy_pass http://backend;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
      proxy_set_header Host $host;
      proxy_read_timeout  36000s;
      proxy_redirect off;
    }

    location / {
      proxy_pass http://frontend;
      proxy_set_header Host $http_host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_redirect off;
      proxy_buffering off;    
    }
}

  upstream backend {
    server 127.0.0.1:8000;
  }

  upstream frontend {
    server 127.0.0.1:8080;
  }

I have these in another upper-tree config already:

  default_type application/octet-stream;
  include  /etc/nginx/mime.types;

This for production env?

Yes I am hosting the webpack built files with another static webserver. Hence the port 8080

I tried a couple of different Nginx configs as well but that did not really help.
Some extra info:
Python ver: 3.6 on Ubuntu 16.04

well looking at the conf file provided you have it configured to serve 127.0.0.1:8080 for the frontend.
This should be a static file from when you run npm run build

https://github.com/SQLMatches/API/blob/master/nginx/production.conf#L47

Also self hosting this project currently is somewhat cancer, has mandatory stripe interrogation & just isn't pleasant in general unless if you're selling it as a service. I am working on a 1.0.0 version what improves self hosting & adds some needed features, but life

Oh I did not knew that stripe integration was mandatory. Ok then since stripe is not available in my region that cancels out the possibilities anyways. Thanks for the help anyways.

Just to keep them in record I also did configure the settings, tried to server with nginx as static but that did not help.

yea isn't ideal, you could always strip out the stripe integration manually if you know how to. 0.0.13 won't be getting any more updates.