Autional Autional
API Reference GitHub autional.com →

POST /auth/me/switch-tenant

Verify user membership in the new tenant, check cross-tenant switching policy, and issue a new JWT token (with the new tenant's roles and permissions) upon successful verification. References: NIST SP 800-53 AC-2, OWASP ASVS V1.2.

Authentication `bearerAuth` application/json

Request Body

Schema: dto.SwitchTenantRequest

FieldTypeRequiredExampleConstraintsDescription
tenant_id string Yes

Responses

StatusDescriptionSchema
200Tenant switched successfully, returns new JWT tokendto.SwitchTenantResponseWrapper
400Invalid request parametersgitee_com_linmes_authms_base_dto.SimpleResponse
401Unauthenticated or invalid tokengitee_com_linmes_authms_base_dto.SimpleResponse
403No target tenant membership or cross-tenant switching disabledgitee_com_linmes_authms_base_dto.SimpleResponse
500Internal server errorgitee_com_linmes_authms_base_dto.SimpleResponse

Referenced Schemas

dto.SwitchTenantResponse

FieldTypeRequiredExampleConstraintsDescription
access_token string No
expires_in integer No
refresh_token string No
token_type string No
user dto.UserInfo No

dto.SwitchTenantResponseWrapper

FieldTypeRequiredExampleConstraintsDescription
code integer No
data dto.SwitchTenantResponse No
message string No
timestamp string No

dto.UserInfo

User basic information

FieldTypeRequiredExampleConstraintsDescription
created_at string No 2026-01-15T10:30:00Z Account creation time
email string No john@example.com Email
id string No usr_abc123 User ID
must_change_password boolean No False Password must be changed
password_expires_in integer No 30 Days until password expires
password_warning string No expiring Password warning: expiring/expired_grace/expired
phone string No 13800138000 Phone
status string No active Status
username string No john.doe Username

gitee_com_linmes_authms_base_dto.SimpleResponse

FieldTypeRequiredExampleConstraintsDescription
code integer No
message string No
timestamp string No