The sso.invitations module manages organization invitations. Organization
management calls require the server-side member-management capability. User
accept/decline calls require an authenticated invitee whose email matches the
invitation.
Core Invitation Methods
sso.invitations.create()
Signature:
create(orgSlug: string, payload: CreateInvitationPayload): Promise<CreateInvitationResponse>
Creates an invitation and queues its email. The response contains
{ invitation, inviter, token }; the plaintext token is returned only at
creation. Neither account password hashes nor the stored invitation-token hash
is exposed.
Parameters:
| Name | Type | Description |
|---|---|---|
| orgSlug | string | Organization slug |
| payload | CreateInvitationPayload | Invitation details |
| payload.email | string | Email address of the person to invite |
| payload.role | string | member, admin, or a custom organization-role slug |
sso.invitations.listForOrg()
Signature:
listForOrg(orgSlug: string): Promise<OrganizationInvitationListItem[]>
Returns items shaped as { invitation, inviter }. The invitation contains
id, email, role, status, expires_at, and created_at; the inviter
contains id, email, and created_at. Secret token material is omitted.
sso.invitations.cancel()
Signature:
cancel(orgSlug: string, invitationId: string): Promise<void>
Cancels a pending invitation when the caller has member-management capability.
sso.invitations.listForUser()
Signature:
listForUser(): Promise<InvitationWithOrg[]>
Returns pending invitations for the authenticated user’s email. Each item has
id, email, role, expires_at, created_at, organization_name, and
organization_slug.
sso.invitations.accept() | decline()
Signature:
accept(token: string): Promise<void>
decline(token: string): Promise<void>
Joins or rejects an organization using the one-time invitation token.
sso.invitations.acceptById() | declineById()
Signature:
acceptById(invitationId: string): Promise<void>
declineById(invitationId: string): Promise<void>
Accepts or declines an invitation by ID. The authenticated user’s email must match the invitee email.
Type Definitions
Import the response interfaces from @drmhse/sso-sdk; the generated TypeScript
declarations are the exact field-level reference.