Skip to content

Conversation

@csrbarber
Copy link
Contributor

Description

  • Update UserManagement.get_authorization_url to generate authorization urls with /user_management/authorize

AuthKit authorization urls should go through /user_management/authorize. Standalone SSO authorization urls should go through /sso/authorize.

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[ ] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

Copy link

@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 Overview

Summary

Changed UserManagement.get_authorization_url to generate authorization URLs with /user_management/authorize instead of /sso/authorize.

  • AuthKit authorization URLs now correctly use /user_management/authorize endpoint
  • Standalone SSO authorization URLs (in WorkOS.SSO module) continue to use /sso/authorize
  • This aligns with WorkOS API expectations where User Management and SSO have separate authorization endpoints
  • All existing tests pass with the updated path

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a simple, well-scoped URL path correction that aligns with API specifications. The modification changes only the authorization endpoint path from /sso/authorize to /user_management/authorize, which is the correct endpoint for AuthKit. All tests continue to pass, and the change maintains backward compatibility since it only affects the generated URL. No security issues, logic errors, or breaking changes introduced.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
lib/workos/user_management.ex 5/5 Updated authorization URL path from /sso/authorize to /user_management/authorize to align with AuthKit expectations

Sequence Diagram

sequenceDiagram
    participant Client as Client Application
    participant SDK as WorkOS Elixir SDK
    participant AuthKit as AuthKit API
    
    Client->>SDK: get_authorization_url(params)
    Note over SDK: Build query params<br/>(client_id, redirect_uri, etc.)
    SDK->>SDK: URI.encode_query()
    SDK-->>Client: {:ok, "base_url/user_management/authorize?query"}
    Client->>AuthKit: Redirect user to authorization URL
    Note over AuthKit: /user_management/authorize<br/>(previously /sso/authorize)
    AuthKit-->>Client: Redirect to callback with code
    Client->>SDK: authenticate_with_code(code)
    SDK->>AuthKit: POST /user_management/authenticate
    AuthKit-->>SDK: Authentication response
    SDK-->>Client: {:ok, %Authentication{}}
Loading

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@csrbarber csrbarber merged commit 5e9c769 into main Oct 16, 2025
2 checks passed
@csrbarber csrbarber deleted the fix-authkit-get-auth-url branch October 16, 2025 18:02
@csrbarber csrbarber mentioned this pull request Oct 16, 2025
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