ppy / osu-web

the browser-facing portion of osu!
https://osu.ppy.sh
GNU Affero General Public License v3.0
978 stars 382 forks source link

Hybrid bot accounts cannot use OAuth delegation #10056

Closed ThePooN closed 1 year ago

ThePooN commented 1 year ago

There are two kinds of bot accounts:

Users with hybrid bot accounts are currently hit by the following error when trying to use the delegate scope:

{"error":"Delegation with Client Credentials is only available to chat bots."}

This came up as Tillerino is looking to switch from IRC to APIv2/WebSockets, but is currently blocked by this check, as isBot only considers full bot accounts. This is also going to hit me and osu!frlive when we eventually start working on organizing full-scale osu!(lazer) tournaments.

Fixing this is non-trivial as all side-effects of making isBot return true for hybrid bots are not desirable. I started working on a patch, adding an isHybridBot method to the User model and replacing usage of isBot by isHybridBot where applicable, please let me know if this is the right direction.

nanaya commented 1 year ago

It's currently a bit more work but it's already possible to get normal auth code token with chat.write scope as long it's for your own user.

If anything I'd rather remove the delegate thing and add a way to create the chat token through settings page directly.

nanaya commented 1 year ago

Yeah, auth code with chat.write seems to work just fine.