fix: accept the event and SSO queries workos-go v10 sends - #119
Merged
Merged
Conversation
The Go SDK repeats events= rather than events[], and it filters with range_start, range_end, and organization_id. Social login is provider=GoogleOAuth. Seeding a directory user into a group never emitted dsync.group.user_added or user_removed.
|
The filter compared `data.organization_id`, so an organization-scoped poller never saw `group.member_added`/`member_removed` (ids only), `dsync.group.user_added`/`user_removed` (organization nested under the user) or `organization.*` (the organization is the payload). Resolving the scope when the event is recorded keeps it after the group or directory it refers to is deleted; it stays off the wire because the spec's Event has no such field.
`domain_hint` ran as a selector ahead of `provider`, so `provider=MicrosoftOAuth&domain_hint=acme.com` 404ed unless some connection claimed the domain, though the spec calls it a pre-fill hint. And a provider matching connections in several organizations took the first, minting the code under whichever tenant was created first. The hint now narrows same-type connections; anything still ambiguous is a 400 rather than a guess.
Domains are case-insensitive, but connections keep theirs as written, so a hint of `acme.com` failed to select a connection stored as `Acme.com` and an otherwise resolvable provider login was refused as ambiguous.
The provider path stopped caring about domain case; the selector that takes a bare domain_hint still did, so the same hint resolved a connection on one path and 404ed on the other.
Nothing stops two organizations claiming the same domain, and the hint-only selector took the first match, so a bare domain_hint could mint the code under the wrong tenant, which is the guess the provider path already declines to make. One rule for both selectors.
Reading `events=` alongside `events[]=` covered workos-go, -node and -ruby, but turned the spec's own form — `style: form, explode: false`, i.e. `events=a,b`, sent by workos-python, -kotlin, -elixir and -rust — from an ignored filter into an empty result, since the joined value was compared as one event name. Production parses the query with `qs` and splits a scalar on commas, so it also takes workos-php's indexed `events[0]=`. Normalize all four forms the way production does, and pin each one in the spec.
…ries # Conflicts: # SUPPORTED.md
Collaborator
|
thanks! |
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.
Summary
workos-go v10.5.0 cannot drive the current emulator for the calls a directory-sync poller and a social login make. Confirmed by pointing that client at unmodified
main(de4ccdc):Events().Listwithevents: ["user.created"]also returnedorganization.created. The SDK encodes the filter as repeatedevents=(url:"events"), andGET /eventsonly readevents[].organization_idand arange_startan hour in the future. Both events from a two-organization seed came back, and so did an event created before the range.SSO().GetAuthorizationURLwithprovider=GoogleOAuthreturned404 connection_not_foundafter aGoogleOAuthconnection existed. Authorizing with that connection's id still returned302and a code.Events().Listfordsync.group.user_addedreturneddsync.user.created,dsync.group.created,dsync.activated, andorganization.created.This keeps Directory Sync read-only over HTTP. Membership events are emitted when a seeded or updated directory user's group set changes, including
dsync.group.user_removedwhen the user leaves a group or is deleted.events[]still works. List order is unchanged: the v10 iterator sendsorder=descitself when the caller omits it.Test plan
bun teston the events, SSO, directory, and directory-seed specsbun testfull suite (1280 pass) before this branchGET /events?events=user.created&events=user.updatedreturns only those typesGET /sso/authorize?provider=GoogleOAuthredirects when an active connection of that type exists