1.0.4 • Published 7 months ago
tcenter-front-auth-sdk v1.0.4
TCenter Front Authentication SDK
Welcome to the TCenter Front Authentication SDK! This SDK provides authentication and authorization functionality for TCenter Front projects.
Installation
You can install the SDK using npm or yarn:
npm install tcenter-front-auth-sdk
Usage
const { MySDK } = require('tcenter-front-auth-sdk');
// Example usage
const email = 'user@example.com';
const password = 'your_password';
const projectPublicKey = 'your_project_public_key';
MySDK.auth.login(email, password, projectPublicKey)
.then((response) => {
console.log('Login successful:', response);
})
.catch((error) => {
console.error('Login failed:', error);
});
Authentication Functions
The SDK provides the following authentication functions:
login(email, password, projectPublicKey): Log in with an email and password.
sendOtpToPhone(projectPublicKey, phone): Send OTP to a phone number.
sendOtpToEmail(projectPublicKey, email): Send OTP to an email address.
checkOtpForPhone(projectPublicKey, phone, code): Check OTP for a phone number.
checkOtpForEmail(projectPublicKey, email, code): Check OTP for an email address.
refreshToken(projectPublicKey, refreshToken): Refresh the access token.
updatePassword(currentPassword, newPassword): Update the user's password.
setPassword(projectPublicKey, password): Set a new password.
resetPassword(projectPublicKey, requestBody): Reset a password.
logout(projectPublicKey): Log out from the system.