clerk / clerk-sdk-python

52 stars 15 forks source link

public_metadata not passed for invite creation #29

Closed jianminglok closed 1 month ago

jianminglok commented 1 month ago

When a user is invited to the application using the code below, the metadata is not passed properly.

res = s.invitations.create(
    request={
        "email_address": email,
        "public_metadata": {"role": "user"},
        "redirect_url": f"{config['FRONTEND_URL']}/accept-invitation",
        "notify": True,
        "ignore_existing": False,
    }
)

This seems to be related to the lines under the create function in src/clerk_backend_api/invitations.py below

if not isinstance(request, BaseModel) and request is not None:
    request = utils.unmarshal(request, models.CreateInvitationRequestBody)
request = cast(models.CreateInvitationRequestBody, request)

The request object returned by these lines contain an empty CreateInvitationPublicMetadata object.

simplesagar commented 1 month ago

Hey @jianminglok We are looking into this issue and will report back soon !

speakeasybot commented 1 month ago

Hi @jianminglok . The API has been updated to allow for arbitrary metadata fields. Please try out https://github.com/clerk/clerk-sdk-python/tree/v1.1.0 and let us know if you run into further issues. Thanks !

speakeasybot commented 1 month ago

Closing out, but please feel free to re-open if the issue persists!