docs: fix state parameter type documentation to match implementation #327
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.
Summary
Fixes #326
The
stateparameter ingetSignInUrl/getSignUpUrlis implemented as a string (matching OAuth 2.0 RFC 6749 specification), but the documentation showed examples using object literals without JSON serialization. This created a mismatch between what the docs promised and what actually works.Changes
Updated all documentation examples to show explicit serialization:
Record<string, any> | undefinedtostring | undefinedwith parsing noteJSON.parse(state)before accessing propertiesJSON.stringify()around state objectJSON.stringify()to all examplesJSON.parse()with null checks in callbacksWhy This Approach
The implementation correctly follows OAuth 2.0 RFC 6749, which defines
stateas an "opaque string". Keeping it as a string gives users control over serialization format (JSON, base64, encrypted tokens, etc.) and matches the WorkOS SDK interface.