feat: add state parameter support to OAuth provider sign-in#134
Merged
Tr00d merged 2 commits intoJul 10, 2026
Merged
Conversation
Tr00d
marked this pull request as ready for review
July 10, 2026 14:27
spydon
approved these changes
Jul 10, 2026
| if (attr == null) | ||
| throw new Exception("Unknown provider"); | ||
|
|
||
| var state = !string.IsNullOrEmpty(options.State) ? options.State : GenerateNonce(); |
There was a problem hiding this comment.
TIL that Go doesn't have a keyword for immutable variables that are not known at compile time 🤯
Contributor
Author
There was a problem hiding this comment.
Same here. We have the const keyword but for compile-time only, and var just infers the type.
Otherwise, immutability is something you have to address through the type. There's no other way to "enforce" it
Tr00d
deleted the
guillaumefaas/sdk-1230-missing-oauth2-state-parameter-in-server-side-pkce
branch
July 10, 2026 14:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes supabase-community/supabase-csharp#222.
What
SignIn(Provider, options)had no way to include astateparameter in the OAuth URL. Without it, server-side callers had no CSRF protection and were forced to manually append state to the returned URL themselves.Fix
StatetoSignInOptions— callers can provide their own value or leave it unsetGetUrlForProvideralways includes astatein the URL: the caller-provided value if set, otherwise an auto-generated nonceStatetoProviderAuthStateso the caller gets back whatever was used, ready to store and validate against the OAuth callbackWhat this doesn't do
State validation is the caller's responsibility — the SDK just ensures the value is in the URL and returned. Storage and comparison against the callback are outside the SDK's scope.