UNPKG

integreat-authenticator-oauth2

Version:
17 lines 482 B
import jwt from 'jsonwebtoken'; export default function signJwt(options) { const { key, secret, audience, algorithm = 'HS256', expiresIn, scope, } = options; const payload = { iss: key, scope, }; const signOptions = { algorithm, audience, ...(expiresIn && { expiresIn }) }; try { const token = jwt.sign(payload, secret, signOptions); return token; } catch { return null; } } //# sourceMappingURL=signJwt.js.map