@medusajs/medusa
Version:
Building blocks for digital commerce
22 lines • 846 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateJwtTokenForAuthIdentity = generateJwtTokenForAuthIdentity;
const utils_1 = require("@medusajs/framework/utils");
function generateJwtTokenForAuthIdentity({ authIdentity, actorType, }, { secret, expiresIn, options, }) {
const expiresIn_ = expiresIn ?? options?.expiresIn;
const entityIdKey = `${actorType}_id`;
const entityId = authIdentity?.app_metadata?.[entityIdKey];
return (0, utils_1.generateJwtToken)({
actor_id: entityId ?? "",
actor_type: actorType,
auth_identity_id: authIdentity?.id ?? "",
app_metadata: {
[entityIdKey]: entityId,
},
}, {
secret,
expiresIn: expiresIn_,
jwtOptions: options,
});
}
//# sourceMappingURL=generate-jwt-token.js.map
;