Hướng dẫn tạo access token
Access Token là một chuỗi ký tự cho phép dịch vụ của bạn có thể sử dụng AICall APIs.
Last updated
Access Token là một chuỗi ký tự cho phép dịch vụ của bạn có thể sử dụng AICall APIs.
Last updated
const jwt = require('jsonwebtoken');
const API_KEY = '<API_KEY>';
const API_SECRET = '<API_SECRET>';
const ACCESS_TOKEN = jwt.sign({ apiKey: API_KEY }, API_SECRET);import jwt
API_KEY = '<API_KEY>'
API_SECRET = '<API_SECRET>'
ACCESS_TOKEN = jwt.encode({ apiKey: API_KEY }, API_SECRET)package org.example;
import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import java.util.Date;
public class Main {
public static void main(String[] args) {
String API_KEY = "<API_KEY>";
String API_SECRET = "<API_SECRET>";
Algorithm algorithm = Algorithm.HMAC256(API_SECRET);
// Include the "iat" claim with the current timestamp
long currentTimeMillis = System.currentTimeMillis();
String ACCESS_TOKEN = JWT.create()
.withClaim("apiKey", API_KEY)
.withIssuedAt(new Date(currentTimeMillis)) // Include "iat" claim
.sign(algorithm);
}
}<?php
use \Firebase\JWT\JWT;
$API_KEY = '<API_KEY>';
$API_SECRET = '<API_SECRET>';
$ACCESS_TOKEN = JWT::encode([ "apiKey" => $API_KEY ], $API_SECRET, 'HS256');