const jwt = require('jsonwebtoken'); require('dotenv').config(); // Load environment variables // Replace these values with the correct user details from the database const user_id = 63; // Change this to the actual user ID from MySQL const email = "yasha.khandelwal@tech4biz.io"; // Change to actual email const role_id = 7; // Change this to the correct role_id // Define role mapping const roleMap = { 6: 'Spurrinadmin', 7: 'Superadmin', 8: 'Admin', 9: 'Viewer', }; const role = roleMap[role_id] || 'UnknownRole'; // Ensure JWT Secret Key is loaded correctly const SECRET_KEY = process.env.JWT_REFRESH_TOKEN_SECRET; if (!SECRET_KEY) { console.error("❌ ERROR: JWT_REFRESH_TOKEN_SECRET is not set in your .env file."); process.exit(1); } // Generate new refresh token const newRefreshToken = jwt.sign( { id: user_id, email, role }, SECRET_KEY, { expiresIn: '7d' } // You can increase to '30d' if needed ); console.log("\n✅ NEW REFRESH TOKEN GENERATED:"); console.log(newRefreshToken); /********************************************************************* * Company: Tech4biz Solutions * Author: Tech4biz Solutions team backend * Description: Replace old formatted tokens with new * Copyright: Copyright © 2025Tech4Biz Solutions. *********************************************************************/