1.0.11 • Published 6 months ago
@pr4j3sh/auth v1.0.11
pr4j3sh/auth
pr4j3sh/auth is an authentication service that enables user registration, login, and profile access. With our SDKs, developers can easily integrate authentication into their own applications.
limited to
10 req/min/user
Documentation
Installation
- Install @pr4j3sh/auth
npm i @pr4j3sh/authUsage
SDK
Client side
- User Registration
import auth from "@pr4j3sh/auth";
const payload = {
username: "johndoe",
password: "securepassword123",
};
const res = await auth.register(payload);
console.log(res);Server side
const { authHandler } = require("@pr4j3sh/auth");
app.get("/protected", authHandler, (req, res) => {
res.json({ user: req.user });
});Curl
- User registration
curl -X POST https://pr4j3sh-auth.up.railway.app/api/auth/register -H 'Content-Type: application/json' -d '{"username":"john", "password":"123456"}'returns JWT token