Skip to content

Bug: API returns HTTP 200 but SDK expects HTTP 201 for create operations #131

@schaenzer

Description

@schaenzer

Prerequisites

Describe the issue

The Kinde Management API returns HTTP 200 OK for successful create operations (users and organizations), but the SDK's RESPONSE_TYPES mapping only includes 201 status codes. This causes the SDK to return None instead of deserializing the response data.

Affected Operations

  • create_user() - Returns None instead of CreateUserResponse
  • create_organization() - Returns None instead of CreateOrganizationResponse

Expected Behavior
When creating a user or organization successfully, the SDK should return a properly deserialized response object containing the created resource data (e.g., id for users, organization.code for organizations).

Actual Behavior
The SDK returns None because the response status code 200 is not mapped in the RESPONSE_TYPES dictionary, only 201 is mapped.

Root Cause
In ManagementClient, the RESPONSE_TYPES dictionary at initialization only maps status code 201 for create operations:

"users": {
    "create": {
        "201": "CreateUserResponse"  # Only 201 is mapped
    }
}

Reproduction

from kinde_sdk.management import ManagementClient

client = ManagementClient(
    domain="your-domain.kinde.com",
    client_id="your_client_id",
    client_secret="your_client_secret"
)

# This returns None instead of CreateUserResponse
response = client.create_user(
    email="[email protected]",
    given_name="Test",
    family_name="User"
)

print(response)  # Output: None (should be CreateUserResponse object)

Current Workaround
We're manually adding the 200 status code mapping after client initialization:
client.RESPONSE_TYPES["users"]["create"]["200"] = "CreateUserResponse"
client.RESPONSE_TYPES["organizations"]["create"]["200"] = "CreateOrganizationResponse"

Library URL

https://github.com/kinde-oss/kinde-python-sdk

Library version

2.2.0

Operating system(s)

Other Linux

Operating system version(s)

Docker Conatiner python:3.13-slim

Further environment details

No response

Reproducible test case URL

No response

Additional information

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions