Skip to content

fix(sdk): omit defaulted screen_hint from auth URLs#102

Merged
gjtorikian merged 1 commit into
mainfrom
restore-choice
May 28, 2026
Merged

fix(sdk): omit defaulted screen_hint from auth URLs#102
gjtorikian merged 1 commit into
mainfrom
restore-choice

Conversation

@gjtorikian
Copy link
Copy Markdown
Contributor

No description provided.

@gjtorikian gjtorikian merged commit 2dc6fa4 into main May 28, 2026
5 checks passed
@gjtorikian gjtorikian deleted the restore-choice branch May 28, 2026 15:01
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 28, 2026

Greptile Summary

This PR fixes GetAuthorizationUrlParams::new() to stop unconditionally injecting screen_hint=sign-in into every generated authorization URL. Because the screen_hint field is already decorated with #[serde(skip_serializing_if = "Option::is_none")], defaulting it to None means the parameter is simply omitted from the URL unless the caller sets it explicitly — matching the WorkOS server's own default behaviour.

  • The previous hardcoded Some(SignIn) default overrode any server-side logic that applies when screen_hint is absent and prevented callers from relying on the server default.
  • The doc comment on the field ("Defaults to sign-in") continues to describe the server-side default accurately, since omitting the parameter leaves the server in control.

Confidence Score: 5/5

Safe to merge — the one-line change correctly removes an unintentional opinionated default, and all existing opt-in uses of screen_hint are unaffected.

The change is minimal and targeted: replacing a hardcoded Some(SignIn) with Default::default() in the constructor. The field is already gated by skip_serializing_if = "Option::is_none", so omitting it when unset is the correct behaviour. No other call-sites are touched, and the authkit helper path already handled screen_hint as optional independently.

No files require special attention.

Important Files Changed

Filename Overview
src/resources/user_management.rs Single-line fix: screen_hint default in GetAuthorizationUrlParams::new() changed from Some(SignIn) to None, so the parameter is omitted from the URL unless the caller sets it explicitly.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant SDK as WorkOS Rust SDK
    participant WorkOS as WorkOS Server

    Note over Caller,WorkOS: Before fix
    Caller->>SDK: GetAuthorizationUrlParams::new(redirect_uri)
    Note over SDK: screen_hint = Some(SignIn)
    SDK->>WorkOS: "GET /sso/authorize?...&screen_hint=sign-in"
    WorkOS-->>Caller: "Auth URL with screen_hint=sign-in"

    Note over Caller,WorkOS: After fix
    Caller->>SDK: GetAuthorizationUrlParams::new(redirect_uri)
    Note over SDK: screen_hint = None (omitted)
    SDK->>WorkOS: GET /sso/authorize?... (no screen_hint)
    WorkOS-->>Caller: Auth URL (server defaults to sign-in)

    Note over Caller,WorkOS: Explicit override (unchanged behavior)
    Caller->>SDK: "params.screen_hint = Some(SignUp)"
    SDK->>WorkOS: "GET /sso/authorize?...&screen_hint=sign-up"
    WorkOS-->>Caller: Auth URL with sign-up screen
Loading

Reviews (1): Last reviewed commit: "fix(sdk): omit defaulted screen_hint fro..." | Re-trigger Greptile

This was referenced May 28, 2026
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.

1 participant