Public APIs - Guide for developers to access our endpoints.
This documentation will guide developers with all the information needed to interact with our API endpoints through the secret key and token.
Context
- Generating secret key
- Why the secret key?
- How to generate the token?
- How can we access the data - API endpoints?
Step - 1. Generating secret key
- This secret key will be unique for each user.
- The application will generate this and will be available in the dashboard
Step - 2. Why secret/public key?
- For each individual user secret key helps to create a token
- The public key is used to validate the token generated by passing in the request headers
Step - 3. How to generate the token?
- The User / Store has to generate the token(JWT) using the secret key
Python
**jwt.encode(payload, JWT_SECRET, JWT_ALGORITHM)**
# Payload - Data to be passed - If no data to be passed - payload will be {}
#JWT_SECRET - Secret key from the account
#JWT_ALGORITHM - HS256
JavaScript
import jwtEncode from '<https://cdn.jsdelivr.net/npm/[email protected]/+esm>';
const secret = 'VQB Private API key / JWT_SECRET';
const data = {};
const jwt = jwtEncode(data, secret);
console.log(jwt);
STEP - 4. How can we access the data - API endpoints?