acristescu / OnlineGo

Repo for the OnlineGo Android app.
https://play.google.com/store/apps/details?id=io.zenandroid.onlinego
GNU General Public License v3.0
207 stars 52 forks source link

403s when creating custom games with bots #138

Open rosenjcb opened 1 year ago

rosenjcb commented 1 year ago

When I try to create a custom correspondence game with the bot, I get a 403. No other info in the error popup.

acristescu commented 1 year ago

Two questions:

rosenjcb commented 1 year ago

@acristescu Forgot to get back on this but:

1.) It was any bot. But I tried it out on amybot for the most part. 2.) I tried logging into a different account and same issue.

What's funny is you can start a bot game on the website and then find the corresponding game in the OnlineGo app with no issues. I'm thinking they changed the API schema for custom bots. Here's the POST request the frontend website sends when creating a new bot game. Does it look significantly different from what the mobile app requests now?

curl 'https://online-go.com/api/v1/players/605979/challenge' \
  -H 'authority: online-go.com' \
  -H 'accept: application/json, text/javascript, */*; q=0.01' \
  -H 'accept-language: en-US,en;q=0.9,he-IL;q=0.8,he;q=0.7' \
  -H 'content-type: application/json' \
  -H 'cookie: csrftoken={{SOME_COOKIE_I_TOOK_OUT}}; sessionid={{SOME_SESSION_ID_I_TOOK_OUT}}' \
  -H 'origin: https://online-go.com' \
  -H 'referer: https://online-go.com/play' \
  -H 'sec-ch-ua: "Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Windows"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: same-origin' \
  -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36' \
  -H 'x-csrftoken: tY4xOMBIfP2uAsEN9576B847MCIWlYRz663oKRXUgef5JuChjbESRamqNm0oDPBs' \
  -H 'x-requested-with: XMLHttpRequest' \
  --data-raw '{"initialized":false,"min_ranking":-1000,"max_ranking":1000,"challenger_color":"automatic","rengo_auto_start":0,"game":{"name":"Friendly Match","rules":"japanese","ranked":false,"width":13,"height":13,"handicap":0,"komi_auto":"automatic","komi":null,"disable_analysis":false,"initial_state":null,"private":false,"rengo":false,"rengo_casual_mode":true,"time_control":"byoyomi","time_control_parameters":{"main_time":604800,"period_time":86400,"periods":5,"periods_min":1,"periods_max":300,"pause_on_weekends":false,"speed":"correspondence","system":"byoyomi","time_control":"byoyomi"},"pause_on_weekends":false},"aga_ranked":false}' \
  --compressed