📐 Authentication schemas
Schemas define endpoint validation and OpenAPI metadata. Start with the setup and HTTP workflow, then use this page to confirm the exact request contract. The matching feature composes each schema and route; use cookie utilities for transport-specific refresh and logout behavior.
Inventory
| Export | Request location | Contract |
|---|---|---|
passwordSchema | N/A | Reusable password object with the SDK password pattern. |
providerSchema | N/A | Reusable provider and providerId object. |
credentialsSchema | N/A | Reusable email/password credential object. |
identitySchema | Body | Credential or provider identity JSON. |
loginWithCredentialsSchema | Body | Credential login with optional body fingerprint. |
resendMfaCodeSchema | Body | MFA challenge token. |
verifyMfaCodeSchema | Body | MFA challenge token and code. |
loginWithOnetimeTokenSchema | Body | One-time login token. |
registerCredentialsSchema | Body | Registration credentials and optional invitation token. |
sendVerificationEmailSchema | Path, body | Identity ID and optional body fingerprint. |
confirmEmailSchema | Body | Email-confirmation token. |
changeEmailSchema | Path, body | Identity ID and new email; source header parameters are commented out. |
checkTokenSchema | Body | Token and optional expected target. |
confirmNewEmailSchema | Body | Email-change token; source header parameters are commented out. |
sendResetPasswordLinkEmailSchema | Body | Email; source header parameters are commented out. |
completePasswordResetSchema | Body | Replacement password; runtime needs an Authorization header that the schema does not validate. |
changePasswordSchema | Path, body | Identity ID, current password, and replacement password. |
deactivateSchema | Body | Identity ID to deactivate. |
activateSchema | Body | Identity ID to activate. |
refreshTokenCookieSchema | Body | Empty cookie-mode refresh body. |
refreshTokenBearerSchema | Body | Bearer-mode refresh token. |
refreshTokenSchema | Body | Deprecated alias of refreshTokenBearerSchema. |
logoutCookieSchema | Body | Empty cookie-mode logout body. |
logoutBearerSchema | Body | Bearer-mode refresh token used for logout. |
deleteRefreshTokensSchema | Path | Identity ID whose refresh records are revoked. |
View shared source context
import {OpenAPIParameter, SchemaDefinition, withSchema} from '../primitives';
const identityIdPathParameter: OpenAPIParameter = {
in: 'path',
name: 'identityId',
required: true,
schema: {
type: 'string',
},
};
const hostHeaderParameter: OpenAPIParameter = {
in: 'header',
name: 'host',
required: true,
schema: {
type: 'string',
},
};
const userAgentHeaderParameter: OpenAPIParameter = {
in: 'header',
name: 'user-agent',
required: true,
schema: {
type: 'string',
},
};
const fingerprintHeaderParameter: OpenAPIParameter = {
in: 'header',
name: 'x-nb-fingerprint',
required: false,
schema: {
type: 'string',
},
};
const authorizationHeaderParameter: OpenAPIParameter = {
in: 'header',
name: 'Authorization',
required: true,
schema: {
type: 'string',
},
};
const defaultPasswordPattern = '^(?=.*[a-z])(?=.*[0-9])[A-Za-z0-9.?/_-]{8,24}$';
Details
passwordSchema
Definition
Reusable object with additionalProperties: false. Field: password is an optional string matching ^(?=.*[a-z])(?=.*[0-9])[A-Za-z0-9.?/_-]{8,24}$. It is spread by completePasswordResetSchema; no route or feature composes it directly.View complete source
providerSchema
Definition
Reusable object with additionalProperties: false. Fields: optional string provider and optional string providerId; the reusable definition has no required array. It is spread by identitySchema; no route or feature composes it directly.View complete source
credentialsSchema
Definition
Reusable object with additionalProperties: false. Fields, in source order: required string email, optional boolean emailVerified with default false, and required string password. It is spread by identitySchema; no route or feature composes it directly.View complete source
identitySchema
Definition
Required application/json body intended to accept either email plus password or provider plus providerId, with no additional properties. Because source spreads the complete credentialsSchema and then providerSchema, the latter overwrites duplicate top-level keys including properties; this export is currently not composed by an Authentication feature or route.View complete source
loginWithCredentialsSchema
Definition
Required application/json body with additionalProperties: false: required string email, optional string fingerprint, and required string password. Used by route: loginWithCredentialsRoute. Used by feature: loginWithCredentialsFeature.View complete source
resendMfaCodeSchema
Definition
Required application/json body with additionalProperties: false and one required string field, token. Used by route: resendMfaCodeRoute. Used by feature: resendMfaCodeFeature.View complete source
verifyMfaCodeSchema
Definition
Required application/json body with additionalProperties: false: required string code, then required string token in source property order; the required array is ['token', 'code']. Used by route: verifyMfaCodeRoute. Used by feature: verifyMfaCodeFeature.View complete source
loginWithOnetimeTokenSchema
Definition
Required application/json body with additionalProperties: false and required string token. Used by route: loginWithOnetimeTokenRoute. Used by feature: loginWithOnetimeTokenFeature.View complete source
registerCredentialsSchema
Definition
Required application/json body with additionalProperties: false. String fields are email, password, and token; password is always required and oneOf additionally requires either email plus password or token plus password. Used by route: registerCredentialsRoute. Used by feature: registerCredentialsFeature.View complete source
sendVerificationEmailSchema
Definition
Required string path parameter identityId plus a required application/json body that allows only optional string fingerprint; the body object itself is required. Used by route: sendVerificationEmailRoute. Used by feature: emailVerificationFeature.View complete source
confirmEmailSchema
Definition
Required application/json body with additionalProperties: false and required string token. Used by route: confirmEmailRoute. Used by feature: confirmEmailFeature.View complete source
changeEmailSchema
Definition
Required string path parameter identityId and required application/json body with no additional properties. Body field email is a required string with minLength: 1 and pattern \S. Host, user-agent, and fingerprint parameters are commented out and are not schema-enforced. Used by route: changeEmailRoute. Used by feature: changeEmailFeature.View complete source
checkTokenSchema
Definition
Required application/json body with additionalProperties: false: optional string target followed by required string token. Used by route: checkTokenRoute. Used by feature: checkTokenFeature.View complete source
confirmNewEmailSchema
Definition
application/json body allowing only required string token; the request body wrapper itself is not marked required. Host, user-agent, and fingerprint parameters are commented out. Used by route: confirmNewEmailRoute. Used by feature: confirmNewEmailFeature.View complete source
sendResetPasswordLinkEmailSchema
Definition
application/json body allowing only required string email with minLength: 1 and pattern \S; the request body wrapper itself is not marked required. Host, user-agent, and fingerprint parameters are commented out. Used by route: sendResetPasswordLinkEmailRoute. Used by feature: sendResetPasswordLinkEmailFeature.View complete source
completePasswordResetSchema
Definition
application/json body spreads passwordSchema and makes password required. The source declares an empty parameters array because host, user-agent, fingerprint, and Authorization entries are commented out; runtime still reads the reset token from Authorization: Bearer <token>. Used by route: completePasswordResetRoute. Used by feature: completePasswordResetFeature.View complete source
changePasswordSchema
Definition
Required string path parameter identityId. The application/json body has no additional properties and requires password (nonempty string matching \S) and newPassword (string matching the default password pattern); the body wrapper is not marked required. Used by route: changePasswordRoute. Used by feature: changePasswordFeature.View complete source
deactivateSchema
Definition
application/json body allowing only required string identityId with minLength: 1 and pattern \S; the body wrapper is not marked required. Host, user-agent, fingerprint, and Authorization parameters are commented out. Used by route: deactivateRoute. Used by feature: deactivateFeature.View complete source
activateSchema
Definition
application/json body allowing only required string identityId with minLength: 1 and pattern \S; the body wrapper is not marked required. Used by route: activateRoute. Used by feature: activateFeature.View complete source
refreshTokenCookieSchema
Definition
Optional application/json body whose schema is an object with no properties and additionalProperties: false. Used by route: refreshTokenRoute. Selected by feature: refreshTokenFeature when authMode is 'cookie'.View complete source
refreshTokenBearerSchema
Definition
application/json body allowing only required string refreshToken; the body wrapper is not marked required. Header parameters are commented out. Used by route: refreshTokenRoute. Selected by feature: refreshTokenFeature outside cookie mode.View complete source
refreshTokenSchema
Definition
Deprecated exact alias of refreshTokenBearerSchema. It adds no fields and is not composed by a current Authentication feature or route.View complete source
logoutCookieSchema
Definition
Optional application/json body whose schema is an object with no properties and additionalProperties: false. Used by route: logoutRoute. Selected by feature: logoutFeature when authMode is 'cookie'.View complete source
logoutBearerSchema
Definition
application/json body allowing only required string refreshToken; the body wrapper is not marked required. Used by route: logoutRoute. Selected by feature: logoutFeature outside cookie mode.View complete source
deleteRefreshTokensSchema
Definition
One required string path parameter, identityId. The commented host, user-agent, and fingerprint parameters are not schema-enforced. Used by route: deleteRefreshTokensRoute. Used by feature: deleteRefreshTokensFeature.View complete source