Tmeister / wp-api-jwt-auth

A simple plugin to add JSON Web Token (JWT) Authentication to WP REST API
GNU General Public License v2.0
558 stars 161 forks source link

Signature verification succeeds, but verification fails in NodeJs with the same key #308

Closed crazyming9528 closed 2 months ago

crazyming9528 commented 2 months ago
const jwt_d = require('jsonwebtoken');

const token = '';
const key = '';

try {
    const decoded = jwt_d.verify(token, key, { algorithms: ['HS256'] });
    console.log("Token is valid and decoded payload is:", decoded);
} catch (err) {
    console.error("Token validation failed:", err.message);
}

use wordpress plugin:

image

use nodejs jsonwebtoken:

image
crazyming9528 commented 2 months ago

my key is error, sorry~~