You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm just trying to create a jwt token using jsonwebtoken version 8.5.1. When I run my web application in a browser I get this error:
Uncaught ReferenceError: global is not defined
The error is in this file:
browser.js
specifically on line 16
var crypto = global.crypto || global.msCrypto
Here are some prints:
Reproduction
Here is the code I'm using
import * as jwt from 'jsonwebtoken';
export class TokenGenerator {
generateToken(secret: string, user: string, scope: string): string {
try {
var secretKey = secret;
const token = jwt.sign({ user, scope }, secretKey, { expiresIn: '1h' });
return token;
} catch (error) {
// Handle the error here
console.error('Error generating token:', error);
throw error;
}
}
}
Environment
Version of this library used: 8.5.1
Version of the platform or framework used, if applicable:
NodeJS 20.11.1,
typescript 4.9.3
Other relevant versions (language, server software, OS, browser):
powerbi-visuals-tools 5.3.0
Other modules/plugins/libraries that might be involved:
I'm not using Angular or React nor any other web framework
The text was updated successfully, but these errors were encountered:
Description
The error is in this file:
browser.js
specifically on line 16
var crypto = global.crypto || global.msCrypto
Here are some prints:
Reproduction
Here is the code I'm using
Environment
Version of this library used: 8.5.1
Version of the platform or framework used, if applicable:
NodeJS 20.11.1,
typescript 4.9.3
Other relevant versions (language, server software, OS, browser):
powerbi-visuals-tools 5.3.0
Other modules/plugins/libraries that might be involved:
I'm not using Angular or React nor any other web framework
The text was updated successfully, but these errors were encountered: