πAuthentication
How to Create a JWT Token π§©
import { sign, SignOptions } from 'jsonwebtoken';
export function generateToken() {
// information to be encoded in the JWT
const payload = {
partnerId: SEPARLY_API_KEY
};
// read private key value
const privateKey = SEPARLY_SECRET_API_KEY; // replace with the Separly Secret API Key
const signInOptions: SignOptions = {
algorithm: 'RS256',
expiresIn: '12h'
};
// generate JWT
return sign(payload, privateKey, signInOptions);
};
βοΈ Talk to us!
Last updated