-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add twitch login support #153
base: main
Are you sure you want to change the base?
Conversation
Since the TwitchOAuth function is virtually identical to the DiscordOAuth endpoint, could things be refactored into one generic function that then allows configuring arbitrary OAuth2 providers via server config files? Not 100% sure how it'd work yet, I'm guessing there'd be only one RCEP left, something like Somehow in the FrontendSettings there'd need to be a list of structs or dicts something, I don't quite recall how complex things can be that get serialized to YAML. I don't think the obsolete "Discrim" field in our user data should be used to tell these apart, because there's the somewhat theoretical but possible chance that a Twitch User ID and a Discord UID would cause a collision... and they're used as database keys. So they'd maybe need to all be prefixed/suffixed with the provider name... not sure if that's all that elegant though or what could fail from that. We also really need to start using the state parameter of the OAuth flow, and for my suggestion of having a shared Then the only remaining question will be which providers besides Discord we'll be enabling on the official server. We could enable Twitch, maybe Steam, Reddit, ... but probably we don't actually want that many of 'em. Unsure. As for your current implementation, reviewing it may be moot if it should be implemented as a refactoring of the existing discord auth... but I did notice some issues just in case.
|
How would you tell the backend what OAuth to use?
(Both of these are mine) Twitch user ID is short (e.g.
This is up to the CelesteNet contributors and admins
I checked on an empty, brand new account, and
Give me a little bit to fix these. Should be a quick fix if I dont get distracted |
When there is an error, there is no `data` array
Discord changed EVERYONEs discrim to `#0`, so this is useless otherwise
…r to add new OAuth methods in the future
@RedFlames Fixed all of your original concerns afaik (apart from what other oauths to use. that is still up to CelesteNet admins). Please re-check this PR |
I'm sorry to say this, but I don't see this rewrite as an improvement... Like, how would one add another oauth2 provider to this? Implement 5 new hard-coded settings properties and extend all the if-statements and ternary operators in... at least 10 places throughout the RCEndpoint? You did motivate me to mock up a draft of how I imagined more generic OAuth2 support to look. :laugheline: / :snip_embarrassed: |
Wasn't exactly sure how to set it up, so fair. I might try and do this later once the new OAuth system is added in? If you have any tips for any future PR (either here or elsewhere) please let me know as I am trying to improve :> |
I feel like this is really jank, but it works. Lmk if there is something I should change to make this fit better into the codebase