Skip to content

Instantly share code, notes, and snippets.

@antonkalik
Created March 9, 2024 23:50
Show Gist options
  • Save antonkalik/9e9b9ae391c963f3fe3fd50ddc7916b6 to your computer and use it in GitHub Desktop.
Save antonkalik/9e9b9ae391c963f3fe3fd50ddc7916b6 to your computer and use it in GitHub Desktop.
Token Service with refreshing
export class TokenService {
private static jwt_secret = process.env.JWT_SECRET!;
public static refreshConfig = () => {
this.jwt_secret = process.env.JWT_SECRET!;
if (!this.jwt_secret) {
throw new Error('JWT secret not found in environment variables!');
}
};
// our verify and sign methods will be the same
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment