Kyoso-Team / kyoso

A web application that takes osu! tournaments beyonds spreadsheets.
http://kyoso.sh
GNU Affero General Public License v3.0
2 stars 1 forks source link

Skip authenticating with Discord if registered #4

Closed TTTaevas closed 1 year ago

TTTaevas commented 1 year ago

getDiscordProfile will likely be reused soon to deal with the process of changing discord accounts I chose to keep getProfiles

okay I won't lie I'm not super satisfied because ctx.cookies.set('session'... is used three different times in the file, but I didn't feel the need to rewrite lots of code only for the sake of not repeating, I think it's good enough

TTTaevas commented 1 year ago

Using updateUser takes care of osu! and discord at the same time, while skipping authenticating with discord (that's the solution you thought about in our discord and it works shockingly well)

But yeah, JWTs, at least for osu!api v2, have the user id in sub and the scopes in scopes! You can use https://oauth.tools/ or https://jwt.io/ to better understand how that stuff works, if you want