Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jonatascastro12
Copy link
Contributor

@jonatascastro12 jonatascastro12 commented Aug 25, 2025

Summary

  • Add provider_query_params parameter to SSO getAuthorizationUrl method
  • Implement consistent query string serialization with UserManagement module
  • Add comprehensive tests for the new functionality

Changes

  • Interface: Added providerQueryParams to SSOAuthorizationURLOptions
  • Implementation: Updated SSO class to handle provider query params using qs.stringify
  • Tests: Added test coverage for both populated and empty provider query params
  • Compatibility: Fixed empty providerScopes array handling to maintain backward compatibility

Test plan

  • All existing SSO tests pass
  • New provider query params tests pass
  • TypeScript compilation succeeds
  • Linting passes
  • Implementation matches UserManagement pattern

Resolves ENT-3776

@jonatascastro12 jonatascastro12 requested a review from a team as a code owner August 25, 2025 15:37
@linear
Copy link

linear bot commented Aug 25, 2025

@jonatascastro12 jonatascastro12 changed the title sso: Add provider_query_params to getAuthorizationUrl method sso: Add provider_query_params to getAuthorizationUrl method Aug 25, 2025
@jonatascastro12 jonatascastro12 self-assigned this Aug 25, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR adds support for provider_query_params to the SSO getAuthorizationUrl method, bringing it in line with similar functionality already present in the UserManagement module. The changes involve three key modifications:

Interface Enhancement: A new optional providerQueryParams property is added to the SSOAuthorizationURLOptions interface, typed as Record<string, string | boolean | number> to support common query parameter data types.

Implementation Refactor: The SSO class undergoes a significant change in query string serialization. The existing toQueryString function is completely rewritten to use the qs library instead of the native URLSearchParams API. This enables handling of complex objects and arrays while maintaining backward compatibility through specific configuration options (alphabetical key sorting, RFC1738 format for space encoding as +).

Comprehensive Testing: New test cases verify the functionality works correctly with populated provider query params containing mixed data types (string, number, boolean) and handles empty objects gracefully. The tests use inline snapshots to verify exact URL encoding behavior.

The implementation follows the established pattern from the UserManagement module, using qs.stringify with consistent configuration options. The change also simplifies provider_scopes handling by removing manual array joining, as the qs library handles array serialization natively with the 'repeat' format. This maintains backward compatibility while extending functionality to support structured query parameters for identity providers during SSO authorization flows.

Confidence score: 4/5

  • This PR introduces significant query string serialization changes that could affect existing integrations, though backward compatibility measures are in place
  • Score reflects the major refactoring of core URL generation logic combined with comprehensive testing and careful compatibility considerations
  • Pay close attention to the SSO implementation file and verify the qs library configuration maintains exact backward compatibility

3 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

@jonatascastro12 jonatascastro12 changed the title sso: Add provider_query_params to getAuthorizationUrl method Add provider_query_params to getAuthorizationUrl method Aug 25, 2025
@jonatascastro12 jonatascastro12 requested review from a team, PavanKulkarni, atainter, ayomifafore, csrbarber, nave91 and nholden and removed request for a team August 25, 2025 17:34
Add support for provider_query_params parameter to SSO getAuthorizationUrl method,
matching the existing UserManagement implementation. This allows passing custom
query parameters to identity providers during the authorization flow.

Changes:
- Add providerQueryParams to SSOAuthorizationURLOptions interface
- Update getAuthorizationUrl to accept and handle providerQueryParams
- Refactor toQueryString to use qs.stringify for consistent serialization
- Add comprehensive tests for provider query params functionality
- Fix empty providerScopes array handling to maintain backward compatibility
@jonatascastro12 jonatascastro12 force-pushed the feature/ent-3776-add-provider_query_params-to-node-sdk branch from f6c24e2 to 0dc0a49 Compare August 25, 2025 18:09
@jonatascastro12 jonatascastro12 merged commit d4ded90 into main Aug 25, 2025
5 checks passed
@jonatascastro12 jonatascastro12 deleted the feature/ent-3776-add-provider_query_params-to-node-sdk branch August 25, 2025 18:30
jonatascastro12 added a commit that referenced this pull request Aug 25, 2025
## Summary
Version bump to 7.69.1

## Changes
- Bump version to 7.69.1 in package.json, package-lock.json, and
src/workos.ts
- Update snapshot tests with new version

## Recent additions in this version
- Add `provider_query_params` to SSO `getAuthorizationUrl` method
(#1347)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants