I have created mapsID and Private Key following documentation of Mapkit JS, but console always shows
"[MapKit] Initialization failed because the authorization token is invalid."
This is my codes :
app.get('/', (req, res) => {
res.sendFile('/index.html')
})
app.get('/services/jwt', (req, res) => {
const header = {
"alg": "ES256",
"typ": "JWT",
"kid": "******"
const payload = {
"iss": "******",
"iat": Date.now() / 1000,
"exp": (Date.now() / 1000) + 15778800,
}
var cert = fs.readFileSync('./AuthKey_********.p8'); // private key that you downloaded
var token = jwt.sign(payload, cert, { header: header });
res.json({ token: token })
})
"[MapKit] Initialization failed because the authorization token is invalid."
This is my codes :
app.get('/', (req, res) => {
res.sendFile('/index.html')
})
app.get('/services/jwt', (req, res) => {
const header = {
"alg": "ES256",
"typ": "JWT",
"kid": "******"
const payload = {
"iss": "******",
"iat": Date.now() / 1000,
"exp": (Date.now() / 1000) + 15778800,
}
var cert = fs.readFileSync('./AuthKey_********.p8'); // private key that you downloaded
var token = jwt.sign(payload, cert, { header: header });
res.json({ token: token })
})