kamiPay LogokamiPay Docs

Authentication

Learn how to authenticate with the kamiPay API

All our endpoints are authenticated using JWT token standard. A specific endpoint will be provided so you can request for new tokens every time. Token Duration will depend on the specific use case ranging from an hour to 1 day. Custom durations can be evaluated on a case by case basis.

You will be provided a user and password that will be used to retrieve tokens. Tokens will then be used as bearer token for authentication through all the endpoints that you have been given access to.

Getting an Access Token

You can get the token authorization using the following step:

const url = "baseURL/auth/token";
 
// Create a new FormData object
const body = new FormData();
 
// Append your data to the FormData object
body.append("username", "YOUR_USERNAME");
body.append("password", "YOUR_PASSWORD");
 
const response = await fetch(url, {
  method: "POST",
  body
});

Response

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJrYW1pcGF5LWJhY2tlb",
  "token_type": "bearer"
}

Using the Token

After obtaining the access token, include it in the Authorization header for all API requests:

Authorization: Bearer YOUR_ACCESS_TOKEN

On this page