Skip to content

Latest commit

 

History

History

README.md

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

Website | Documentation

Installation

npm i @pr4j3sh/auth

Usage

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

References