@koompi/auth
v1.0.2
Published
This is a client library for interacting with the API of a service called KOOMPI Auth. It provides functions for login, registration, password change, and Google login.
Downloads
5
Readme
KOOMPI Auth
This is a client library for interacting with the API of a service called KOOMPI Auth. It provides functions for login, registration, password change, and Google login.
Installation
To use this library, you need to have Node.js and npm installed on your system. Then, follow these steps:
npm install @koompi/auth
or
yarn add @koompi/auth
Usage
First, import the API client into your JavaScript/TypeScript file:
import auth from "@koompi/auth";
Login
To perform a login operation, use the login function:
auth.login({ email: "[email protected]", password: "password123" })
.then((data) => {
// Handle the response data
})
.catch((error) => {
// Handle any errors
});
Registration
To register a new user, use the register function:
auth.register({
fullname: "John Doe",
email: "[email protected]",
password: "password123",
confirmPassword: "password123",
})
.then((data) => {
// Handle the response data
})
.catch((error) => {
// Handle any errors
});
Google Login
To perform a login operation using Google, use the loginWithGoogle function:
auth.loginWithGoogle({ tokenId: "googleToken123" })
.then((data) => {
// Handle the response data
})
.catch((error) => {
// Handle any errors
});
Offline Registration (For School Management System)
To register a new user offline, use the offlineRegister function:
auth.offlineRegister({
firstname: "John",
lastname: "Doe",
email: "[email protected]",
password: "password123",
})
.then((data) => {
// Handle the response data
})
.catch((error) => {
// Handle any errors
});
Change Password
To change the password, use the changePassword function:
auth.changePassword({
token: "changeToken123",
password: "newPassword123",
confirmPassword: "newPassword123",
})
.then((data) => {
// Handle the response data
})
.catch((error) => {
// Handle any errors
});
Contributing
Contributions are welcome! If you find any issues or have suggestions for improvements, please create a new issue or submit a pull request.
License
This project is licensed under the MIT License.