Skip to main content

NAuthEndpoints

Package: @nauth-toolkit/client Type: Interface

Endpoint paths configuration for the client SDK. Override these if your backend uses different paths.

Interface

interface NAuthEndpoints {
// Authentication
login: string;
signup: string;
logout: string;
logoutAll: string;
refresh: string;

// Challenge Flow
respondChallenge: string;
resendCode: string;
getSetupData: string;
getChallengeData: string;

// User Profile
profile: string;
updateProfile: string;
changePassword: string;
requestPasswordChange: string;
forgotPassword: string;
confirmForgotPassword: string;
confirmAdminResetPassword: string;

// MFA Management
mfaStatus: string;
mfaDevices: string;
mfaSetupData: string;
mfaVerifySetup: string;
mfaRemove: string;
mfaPreferred: string;
mfaBackupCodes: string;

// Social Authentication
socialRedirectStart: string;
socialExchange: string;
socialLinked: string;
socialLink: string;
socialUnlink: string;
socialVerify: string;

// Device Trust
trustDevice: string;
isTrustedDevice: string;

// Audit
auditHistory: string;
}

Default Endpoints

{
login: '/login',
signup: '/signup',
logout: '/logout',
logoutAll: '/logout/all',
refresh: '/refresh',
respondChallenge: '/respond-challenge',
resendCode: '/challenge/resend',
getSetupData: '/challenge/setup-data',
getChallengeData: '/challenge/challenge-data',
profile: '/profile',
updateProfile: '/profile',
changePassword: '/change-password',
requestPasswordChange: '/request-password-change',
forgotPassword: '/forgot-password',
confirmForgotPassword: '/forgot-password/confirm',
confirmAdminResetPassword: '/reset-password/confirm',
mfaStatus: '/mfa/status',
mfaDevices: '/mfa/devices',
mfaSetupData: '/mfa/setup-data',
mfaVerifySetup: '/mfa/verify-setup',
mfaRemove: '/mfa/method',
mfaPreferred: '/mfa/preferred-method',
mfaBackupCodes: '/mfa/backup-codes/generate',
socialLinked: '/social/linked',
socialLink: '/social/link',
socialUnlink: '/social/unlink',
socialVerify: '/social/:provider/verify',
socialRedirectStart: '/social/:provider/redirect',
socialExchange: '/social/exchange',
trustDevice: '/trust-device',
isTrustedDevice: '/is-trusted-device',
auditHistory: '/audit/history',
}

Example

Override endpoints if your backend uses different paths:

const client = new NAuthClient({
baseUrl: 'https://api.example.com/auth',
tokenDelivery: 'cookies',
onSessionExpired: () => {},
endpoints: {
login: '/signin', // Custom path
signup: '/register', // Custom path
// ... other endpoints use defaults
},
});

Used By